[英]Simple basic relative path on file_get_content() function
我正在嘗試在<style>
標簽中輸出screen.css
文件的內容。
我以為這是容易的部分,但是相對路徑不起作用?
看我的代碼...
<?php printf('<style type="text/css">%s</style>', file_get_contents('css/screen.css?v='.rand()) ); ?>
所以從理論上講,這段代碼在我的index.php
,相對路徑應該找到我的php文件本地的css文件夾? 但是我得到這個錯誤...
Warning: file_get_contents(./css/screen.css?v=1836240868): failed to open stream: No such file or directory in index.php on line 18
');
在下面查看我的文件夾我的結構...
如果有人可以在這方面給我一些建議或幫助,那就太好了。
郵遞區號
define("BASE_URI", "http://example.com/");
HTML代碼
<link href="<?php echo BASE_URI;?>/folder/style.css" rel="stylesheet" />
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.