php include出錯的解決方法:1、檢查include檔案的位置是否正確;2、偵測被包含的檔案讀取權限是否開啟。
本文操作環境:Windows7系統、PHP7.1版,DELL G3電腦
php include出錯怎麼辦?
php腳本中include檔案報錯解決方法
經常當php頁面中利用include, require, require_once包含了一些其他位置的頁面時,會出現錯誤,例如沒有發現次頁面,或權限不允許等,可以根據以下方法來排除
1. 出現「未找到檔案「類似的錯誤時候,檢查include檔案的位置是否正確,下面引用php手冊頁面的原話:
Files for including are first looked in include_path relative to the current working directory and then in the directory of the current script. E.g. if your include_path is libraries, current working directory is /www/, you included include/ 1z0-147 .php and there is include "b.php" in that file, b.php is first looked in /www/libraries/ and then in /www/include/. If filename begins with ./ or ../, it is looked only in include_path relative to the current working directory.
2. 當出現permission deny 類似錯誤的時候,依下列方法排除
a) 偵測被包含的檔案讀取權限是否開啟
b) 偵測被包含的檔案路徑上的每個目錄的x權限是否打開,該權限決定了目錄是否能被瀏覽。
推薦學習:《PHP影片教學》
以上是php include出錯怎麼辦的詳細內容。更多資訊請關注PHP中文網其他相關文章!