官网:http://pecl.php.net/package/hidef
简介:
Allow definition of user defined constants in simple ini files, which are then processed like internal constants, without any
of the usual performance penalties.
允许使用简单的ini文件来定义需要的常量,就像使用内部变量一样,而且没有使用Define的性能问题。
作者说Hidef is initialized in php module init, before apache starts spawning children.
在apache启动前,PHP启动时创建并初始化了这些常量,这样就不需要在php里define常量了,性能自然没有任何问题了!
在Nginx下同样可用,以下是安装过程:
1、下载并解压进入目录
# wget http://pecl.php.net/get/hidef-0.1.8.tgz
# tar zxvf hidef-0.1.8.tgz
# cd hidef-0.1.8
2、没有configure文件,执行phpize创建该文件
# /usr/local/webserver/php/bin/phpize
# ./configure --enable-hidef --with-php-c/local/webserver/php/bin/php-config
# make
# make install
3、添加到php.ini文件里面
# vi /usr/local/webserver/php/etc/php.ini
-----------------------------------------------
extension=hidef.so
hidef.ini_path=/usr/local/webserver/php/etc/
------------------------------------------------------------------------------
注意,如果php.ini文件里面没有定义hidef.ini_path,则默认.ini文件读取位置为/hidef,只需手工创建文件 vi /hidef/hidef.ini即可。
# vi /usr/local/webserver/php/etc/hidef.ini(此处根据情况自己调整路径)
复制代码 代码如下:
[hidef]
int ANSWER = 42;
str HX = "9enjoy";
float PIE = 3.14159;
beta v1.1版本为第一个版本,简单的整合了基础功能,各位站长拿到程序后,不要纠结后台的功能简单,后续将不断更新扩展。在beta v1.1版本使用过程中遇到什么问题,请登录 www.loftto.com 进行反馈! 安装说明######重要提醒:程序不支持二级目录安装,请使用一级目录或二级目录绑定!#第一步,确定你的服务器支持PHP+mysql。#第二步,确定你的服务器开启了gd库。#第三步,
0

以上就介绍了define 提高define性能的php扩展hidef的安装和使用,包括了define方面的内容,希望对PHP教程有兴趣的朋友有所帮助。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号