php闈欐€佸彉閲廳efine,static,const_PHP鏁欑▼ | 甯涔嬪
鏈€绠€鍗曞畾涔夋柟娉?/p>
define() 鍑芥暟瀹氫箟涓€涓父閲忋€?/p>
甯搁噺绫讳技鍙橀噺锛屼笉鍚屼箣澶勫湪浜庯細
鍦ㄨ瀹氫互鍚庯紝甯搁噺鐨勫€兼棤娉曟洿鏀?br />
甯搁噺鍚嶄笉闇€瑕佸紑澶寸殑缇庡厓绗﹀彿 ($)
浣滅敤鍩熶笉褰卞搷瀵瑰父閲忕殑璁块棶
甯搁噺鍊煎彧鑳芥槸瀛楃涓叉垨鏁板瓧
璇硶
define(name,value,case_insensitive)
class foo {
static $my_static = 5;
public $my_prop = 'bla';
}print foo::$my_static; copyright dedecms
$obj = new foo;
print $obj->my_prop;
?>
const 鏄父閲忥紝鍗充粠绋嬪簭杩愮畻寮€濮嬪埌缁撴潫锛屾暟鍊间笉鍙樼殑閲忋€?/p>
class say_const{
const charset=”涓浗”锛?nbsp;
publice function say_hello(){
echo slef::charset;
}
}
$const1=new say_const()’
$const1->say_hello();
?>
杈撳嚭灏辨槸“涓浗”
涓嬮潰涓€娆惧畬鏁寸殑闈欐€佸彉閲?/p>
function write_file($file,$msg,$usecheck=5){
static $check=1;//杩欓噷鐢ㄥ埌浜唦
$f=@fopen($file,"a+b");
if($f){
if(flock($f,lock_ex)){
fwrite($f,$msg);
flock($f,lock_un);
fclose($f);
}else{
fclose($f);
$check++;
if($check sleep(1);//鏆傚仠涓嬬▼搴?绛夊叾浠栬繘绋嬮噴鏀捐璧勬簮
write_file($file,$msg);
}
}
}else{
$check++;
if($check sleep(1);//鏆傚仠涓嬬▼搴?绛夊叾浠栬繘绋嬮噴鏀捐璧勬簮
write_file($file,$msg);
}
}
}
下一篇: Ajax如何实现网站劫持的检测
推荐阅读
-
Linux下PHP连接Oracle数据库_PHP
-
PHP使用empty检查函数返回结果时报Fatal error: Can't use function return value in write context的问题 - 心中的飞梦
-
PHP安装memcached扩展笔记_PHP
-
PHP错误Warning:mysql_query()解决方法_PHP
-
php实现utf-8转unicode函数代码实例
-
【性能优化】PHP代码输出压缩后HTML
-
记录页面执行时间php代码
-
PHP实现导出excel数据的类库用法
-
CodeIgniter控制器之业务逻辑实例分析,codeigniter控制器_PHP教程
-
关于PHP Notice: A non well formed numeric value encountered,