eAccelerator是一个开源PHP加速器,优化程序,编码器和动态内容缓存。它通过在编译状态下对它们进行缓存以提高PHP脚本的性能,所以那些 系统开销在编译时几乎可
它还能够对脚本进行优化以便加速它们的执行速度。利用eAccelerator可以减少服务器的负载并提高PHP代码的执行时间。
eAccelerator配置选项:
复制代码 代码如下:
zend_extension_ts=”X:Appphp-5.2.13-Win32exteaccelerator.dll”
eaccelerator.shm_size=”32″
eaccelerator.cache_dir=”X:Appphp-5.2.13-Win32 emp”
eaccelerator.enable=”1″
eaccelerator.optimizer=”1″
eaccelerator.check_mtime=”1″
eaccelerator.debug=”0″
eaccelerator.filter=”"
eaccelerator.shm_max=”0″
eaccelerator.shm_ttl=”0″
eaccelerator.shm_prune_period=”0″
eaccelerator.shm_only=”0″
eaccelerator.compress=”1″
eaccelerator.compress_level=”9″
zend_extension_manager.optimizer_ts=”X:AppendendOptimizer-3.3.0libOptimizer-3.3.0″
zend_extension_ts=”X:AppendendOptimizer-3.3.0libendExtensionManager.dll”
zend_optimizer.optimization_level=”512″
eAccelerator配置参数详细说明:
eaccelerator.shm_size
指定 eAccelerator 能够使用的共享内存数量,单位:MB。“0″ 代表操作系统默认。默认值为 “0″。
eaccelerator.cache_dir
用户磁盘缓存的目录。eAccelerator 在该目录中存储预编译代码、session 数据、内容等。相同的数据也可以存储于共享内存中(以获得更快的存取速度)。默认值为 “/tmp/eaccelerator”。
eaccelerator.enable
开启或关闭 eAccelerator。”1″ 为开启,”0″ 为关闭。默认值为 “1″。
eaccelerator.optimizer
开启或关闭内部优化器,可以提升代码执行速度。”1″ 为开启,”0″ 为关闭。默认值为 “1″。
eaccelerator.debug
开启或关闭调试日志记录。”1″ 为开启,”0″ 为关闭。默认值为 “0″。
eaccelerator.check_mtime
开启或关闭 PHP 文件改动检查。”1″ 为开启,”0″ 为关闭。如果您想要在修改后重新编译 PHP程序则需要设置为 “1″。默认值为 “1″。
eaccelerator.filter
判断哪些 PHP 文件必须缓存。您可以指定缓存和不缓存的文件类型(如 “*.php *.phtml”等),如果参数以 “!” 开头,则匹配这些参数的文件被忽略缓存。默认值为 “”,即,,所有 PHP 文件都将被缓存。
eaccelerator.shm_max
当使用 ” eaccelerator_put() ” 函数时禁止其向共享内存中存储过大的文件。该参数指定允许存储的最大值,单位:字节 (10240, 10K, 1M)。”0″ 为不限制。默认值为 “0″。
eaccelerator.shm_ttl
当 eAccelerator 获取新脚本的共享内存大小失败时,它将从共享内存中删除所有在最后 “shm_ttl” 秒内无法存取的脚本缓存。默认值为 “0″,即:不从共享内春中删除任何缓存文件。
eaccelerator.shm_prune_period
当 eAccelerator 获取新脚本的共享内存大小失败时,他将试图从共享内存中删除早于“shm_prune_period” 秒的缓存脚本。默认值为 “0″,即:不从共享内春中删除任何缓存文件。
eaccelerator.shm_only
允许或禁止将已编译脚本缓存在磁盘上。该选项对 session 数据和内容缓存无效。默认值为 “0″,即:使用磁盘和共享内存进行缓存。
eaccelerator.compress
允许或禁止压缩内容缓存。默认值为 “1″,即:允许压缩。
eaccelerator.compress_level
指定内容缓存的压缩等级。默认值为 “9″,为最高等级。
eaccelerator.name_sapce
一个所有键(keys)的前缀字符串。如果设置该前缀字符串则允许 .htaccess 或者 主配置文件在相同主机上运行两个相同的键名。
eaccelerator.keys
eaccelerator.sessions
eaccelerator.content
判断哪些键(keys)、session 数据和内容将被缓存。可用参数值为:
1.“shm_and_disk” – 同时在共享内存和磁盘中缓存数据(默认值);
2.“shm” – 如果共享内存用尽或者数据容量大于 “eaccelerator.shm_max”,则在共享内存或磁盘中缓存数据;
3.“shm_only” – 仅在共享内存中缓存数据;
4.“disk_only” – 仅在磁盘中缓存数据;
5.“none” – 禁止缓存数据。
eAccelerator应用程序接口(API):
eaccelerator_put($key, $value, $ttl=0)
将 $value 存储在共享内存中,并存储 $tll 秒。
eaccelerator_get($key)
从共享内存中返回 eaccelerator_put() 函数所存储的缓存数值,如果不存在或者已经过期,则返回 null。
eaccelerator_rm($key)
从共享内存中删除 $key。
eaccelerator_gc()
删除所有过期的键(keys)
eaccelerator_lock($lock)
创建一个指定名称的锁(lock)。该锁可以通过 eaccelerator_unlock() 函数解除,在请求结束时也会自动解锁。例如:
eaccelerator_unlock($lock)
解除指定名称的锁(lock)。
eaccelerator_set_session_handlers()
安装 eAccelerator session 句柄。从 PHP 4.2.0 以后,您可以通过设置 php.ini 中的 “session.save_handler=eaacelerator” 安装 eAccelerator 句柄。
eaccelerator_cache_output($key, $eval_code, $ttl=0)
在共享内存中缓存 $eval_code 的输出,缓存 $ttl 秒。可以调用 mmcach_rm() 函数删除相同 $key 的输出。例如:
eaccelerator_cache_result($key, $eval_code, $ttl=0)
在共享内存中缓存 $eval_code 的结果,缓存 $ttl 秒。可以调用 mmcach_rm() 函数删除相同 $key 的结果。例如:
eaccelerator_cache_page($key, $ttl=0)
缓存整个页面,且缓存 $ttl 秒。例如:
eaccelerator_rm_page($key)
从缓存中删除由 eaccelerator_cache_page() 函数创建的相同 $key 的页。
eaccelerator_encode($filename)
返回 $filename 文件经过编译后的编码。
eaccelerator_load($code)
加载被 eaccelerator_encode() 函数编码过的脚本。

php把负数转为正整数的方法:1、使用abs()函数将负数转为正数,使用intval()函数对正数取整,转为正整数,语法“intval(abs($number))”;2、利用“~”位运算符将负数取反加一,语法“~$number + 1”。

实现方法:1、使用“sleep(延迟秒数)”语句,可延迟执行函数若干秒;2、使用“time_nanosleep(延迟秒数,延迟纳秒数)”语句,可延迟执行函数若干秒和纳秒;3、使用“time_sleep_until(time()+7)”语句。

php字符串有下标。在PHP中,下标不仅可以应用于数组和对象,还可应用于字符串,利用字符串的下标和中括号“[]”可以访问指定索引位置的字符,并对该字符进行读写,语法“字符串名[下标值]”;字符串的下标值(索引值)只能是整数类型,起始值为0。

php除以100保留两位小数的方法:1、利用“/”运算符进行除法运算,语法“数值 / 100”;2、使用“number_format(除法结果, 2)”或“sprintf("%.2f",除法结果)”语句进行四舍五入的处理值,并保留两位小数。

判断方法:1、使用“strtotime("年-月-日")”语句将给定的年月日转换为时间戳格式;2、用“date("z",时间戳)+1”语句计算指定时间戳是一年的第几天。date()返回的天数是从0开始计算的,因此真实天数需要在此基础上加1。

在php中,可以使用substr()函数来读取字符串后几个字符,只需要将该函数的第二个参数设置为负值,第三个参数省略即可;语法为“substr(字符串,-n)”,表示读取从字符串结尾处向前数第n个字符开始,直到字符串结尾的全部字符。

方法:1、用“str_replace(" ","其他字符",$str)”语句,可将nbsp符替换为其他字符;2、用“preg_replace("/(\s|\ \;||\xc2\xa0)/","其他字符",$str)”语句。

查找方法:1、用strpos(),语法“strpos("字符串值","查找子串")+1”;2、用stripos(),语法“strpos("字符串值","查找子串")+1”。因为字符串是从0开始计数的,因此两个函数获取的位置需要进行加1处理。


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment

WebStorm Mac version
Useful JavaScript development tools

Notepad++7.3.1
Easy-to-use and free code editor

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.