久久久久久久视色,久久电影免费精品,中文亚洲欧美乱码在线观看,在线免费播放AV片

<center id="vfaef"><input id="vfaef"><table id="vfaef"></table></input></center>

    <p id="vfaef"><kbd id="vfaef"></kbd></p>

    
    
    <pre id="vfaef"><u id="vfaef"></u></pre>

      <thead id="vfaef"><input id="vfaef"></input></thead>

    1. 站長資訊網(wǎng)
      最全最豐富的資訊網(wǎng)站

      如何解決php類的自動加載失敗問題

      php類自動加載失敗的解決辦法:1、打開相應(yīng)的PHP代碼文件;2、添加“$class = str_replace("\","/",$class);”代碼即可。

      如何解決php類的自動加載失敗問題

      本文操作環(huán)境:windows7系統(tǒng)、PHP7.1版、Dell G3電腦。

      如何解決php類的自動加載失敗問題?

      PHP 命名空間下的自動加載失敗

      場景描述

      文件在本地win系統(tǒng)下測試無異常,代碼如下:

      function stu_autoload($class){       if(file_exists($class.".php")){        require ( $class.".php");     }else{        die("unable to autoload Class $class");     } }  spl_autoload_register("stu_autoload");

      部署到Ubuntu服務(wù)器上異常,報錯為 unable to autoload Class xxxxxx

      解決方案

      根據(jù)報錯,發(fā)現(xiàn) $class 的值需要形如 stuAppdaoStuInfo 才可行, 文件路徑需要將 轉(zhuǎn)義成 /,因此添加一行代碼即可。

          $class = str_replace("\","/",$class);

      綜上,修改后的自動加載代碼如下:

      function stu_autoload($class){     //路徑轉(zhuǎn)義     $class = str_replace("\","/",$class);    if(file_exists($class.".php")){        require ( $class.".php");     }else{        die("unable to autoload Class $class");     } }  spl_autoload_register("stu_autoload");

      推薦學(xué)習(xí):《PHP視頻教程》

      贊(0)
      分享到: 更多 (0)
      網(wǎng)站地圖   滬ICP備18035694號-2    滬公網(wǎng)安備31011702889846號