[英]Using file_get_contents() php file do not get executed when placed in a directory only root?
使用file_get_contents($ filePath)獲取通過Url執行的php文件,只要該php文件-$ sassConfigName-在根目錄中就可以正常工作
問題:如果文件位於目錄中,如何在url中以相同方式使用文件?
工作示例:
$ sassConfigName ='sassconfig.php'; // sassconfig.php在根目錄中
$ filePath =' http://bootstrap4.dev/ '。 $ sassConfigName 。'/ main.scss';
file_get_contents($filePath);
不起作用的示例:
$ sassConfigName ='./config/sassconfig.php'; // sassconfig.php位於目錄config中。 但是現在Url中的參數錯誤。 $ filePath =' http ://bootstrap4.dev/'。$ sassConfigName。'/ main.scss';
file_get_contents($filePath);
Regards
<?php
$sassConfigName="/php/";
$filePath='http://www.w3schools.com'.$sassConfigName.'func_filesystem_file_get_contents.asp';
echo file_get_contents($filePath);
?>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.