最近遇到幾個舊程式都會跑出來php deprecated,
記錄一下修正的替代方案.
1. session_register (pay attention to header already sent)
deprecated:
session_register("WebHD_Login");
$_SESSION['WebHD_Login']=$arr[0];
mod:
//session_register("WebHD_Login");
session_start();
$_SESSION['WebHD_Login']=$arr[0];
2. split
//preg_split(), which uses a Perl-compatible regular expression syntax,
//is often a faster alternative to split(). If you don't require the
//power of regular expressions, it is faster to use explode(), which
//doesn't incur the overhead of the regular expression engine.
deprecated:
$tmp=split('\.',$file);
mod:
$tmp=explode('.',$file);
3. ereg
//ereg->mb_ereg
deprecated:
if (ereg("MSIE",$_SERVER["HTTP_USER_AGENT"])){
mod:
if (mb_ereg("MSIE",$_SERVER["HTTP_USER_AGENT"])){
沒有留言:
張貼留言