我正在尝试读取文件夹外的public_html
文件。
$file = '/var/www/new.txt';
$fileHandle = file_get_contents($file);
if($result)
{
$o = mysqli_num_rows($result);
if ($o)
readfile($file);
else
echo 'Error authenticating please contact support';
}
else {
echo '';
}
我认为 php 文件没有访问该文件的权限,我怎样才能使其有权访问该文件?
尝试通过关系路径访问您的文件。
例如您的文件夹结构是:
-folder
--new.txt
-public_html
--reader.php
在您的 reader.php 中:
<?php
$file = '../folder/new.txt';
$fileHandle = file_get_contents($file);
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句