如何解決php include失敗的問題

藏色散人
發布: 2023-03-04 06:02:01
原創
3592 人瀏覽過

php include失敗的解決方法:1、檢查include檔案的位置是否正確;2、偵測被包含的檔案讀取權限是否開啟;3、偵測被包含的檔案路徑上的每個目錄的x權限是否開啟。

如何解決php include失敗的問題

推薦:《PHP影片教學

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/a.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 include失敗的問題的詳細內容。更多資訊請關注PHP中文網其他相關文章!

相關標籤:
php
來源:php.cn
本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板
關於我們 免責聲明 Sitemap
PHP中文網:公益線上PHP培訓,幫助PHP學習者快速成長!