為表示友好,本人釋放出多年收藏精悍短小php常用經(jīng)驗(yàn):
PHP_VERSION獲取php當(dāng)前版本==phpversion()
define("icyzhl","zhanghongliang")
echo icyzhl;//printof:zhanghongliang
獲取當(dāng)前文件的文件名:$installfile = basename(__FILE__);
堅(jiān)持類(lèi)是否已經(jīng)定義:class_exists
function_exists
這種語(yǔ)句:$sql='select * from users where id='1'',
這樣寫(xiě)是錯(cuò)誤的,如下寫(xiě):$sql='select * from users where id=\'1\''
這個(gè)例子也是:
$alert = " onSubmit=\"return confirm('$lang[db_drop_table_confirm]');\"";
如果php版本小于4.0.1的話,$_GET=&$HTTP_GET_VARS,其它的也一樣
usleep(1000)//沉睡1秒鐘
例子:
list($utime,$stime)=explode(" ",microtime());
$first_time=$stime.$utime
usleep(100);
$last_time=$stime.$utime;
echo $last_time-$first_time;
$_SERVER["PHP_SELF"]; ---
http://localhost/test.php?a=haha&b=hehe&c=&d=hoho (/test.php)
$_SERVER['HTTP_REFERER']; ---
http://localhost/test.php?a=haha&b=hehe&c=&d=hoho (即獲取鏈接到此頁(yè)面的文件地址)
$_SERVER["REQUEST_URL"]; ---
http://localhost/test.php?a=haha&b=hehe&c=&d=hoho (/test.php?a=haha&b=hehe&c=&d=hoho)
更多經(jīng)驗(yàn),大家可以訪問(wèn):
http://m.fn9c.com/wangjianjiqiao/
或者加我本人QQ499375381,方便討論php常用技巧或者了解更多常用php小技巧