楼主按:我也是在学习
1,ob_start()这个命令就是在发送文件头之前页面内容被缓存在内存中。
2,一个看着不错的开源软件:eAccelerator
摘录一段:
eAccelerator is a free open-source PHP accelerator & optimizer. It increases the performance of PHP scripts by caching them in their compiled state, so that the overhead of compiling is almost completely eliminated. It also optimizes scripts to speed up their execution. eAccelerator typically reduces server load and increases the speed of your PHP code by 1-10 times.
eAccelerator was born in December 2004 as a fork of the Turck MMCache project. Turck MMCache was created by Dmitry Stogov and much of the eAccelerator code is still based on his work.
翻译和解释如下: eAccelerator是免费开源PHP加速和优化器。它通过在内存中缓存PHP代码来加速它的执行速度。 MMCache原作者是Dmitry Stogov,后被Zend挖走。很多Eaccelerator代码是基于MMCache。
英文来源: php.net
这里是例子
如果出现这个错误: Fatal error: Call to undefined function shmop_open() in...
到php.ini把 extension=php_shmop.dll 前的“;”去掉,重新编译,使生效。
待续
按:不知道怎么Windows下怎么编译php,就重启了一下,显示如下。网站空间不支持shmop,所以,目前还用不到这个,放这里做个记号。
SHM Block Size: 100 has been created. The data inside shared memory was: my shared memory block
附上述的例子代码:
< ?php
// Create 100 byte shared memory block with system id of 0xff3
$shm_id = shmop_open(0xff3, "c", 0644, 100);
if (!$shm_id) {
echo "Couldn't create shared memory segment\n";
}
// Get shared memory block's size
$shm_size = shmop_size($shm_id);
echo "SHM Block Size: " . $shm_size . " has been created.\n";
// Lets write a test string into shared memory
$shm_bytes_written = shmop_write($shm_id, "my shared memory block", 0);
if ($shm_bytes_written != strlen("my shared memory block")) {
echo "Couldn't write the entire length of data\n";
}
// Now lets read the string back
$my_string = shmop_read($shm_id, 0, $shm_size);
if (!$my_string) {
echo "Couldn't read from shared memory block\n";
}
echo "The data inside shared memory was: " . $my_string . "\n";
//Now lets delete the block and close the shared memory segment
if (!shmop_delete($shm_id)) {
echo "Couldn't mark shared memory block for deletion.";
}
shmop_close($shm_id);
? >