file_get_contents() error: failed to open stream : invalid argument
file_get_contents() error: failed to open stream : invalid argument
$i = 0;
$name_url = '../../accounts/full/'.$frd_array[$i].'/profile/name.txt';
$name = file_get_contents($name_url);
$user_id = file_get_contents('../../accounts/full/'.$frd_array[$i].'/profile/user_id.txt');
$status = file_get_contents('../../accounts/full/'.$frd_array[$i].'/profile/status.txt');
echo "
<div class='frd_acc'>
<img class='c_avatar' src='../accounts/full/".$frd_array[$i]."/profile/avatar.png'>
<div class='c_name'>".$name."</div> <kbd class='c_user_id'>".$user_id."</kbd>
<div class='status'>".$status."</div>
</div>"
以上是我的 php 代码。当我执行此 php 脚本时,我收到以下错误:
Warning: file_get_contents(../../accounts/full/amaan2 amaan2 /profile/name.txt): failed to open stream: Invalid argument in E:\FreeJi\php\chats\my_frds.php on line 16
Warning: file_get_contents(../../accounts/full/amaan2 amaan2 /profile/user_id.txt): failed to open stream: Invalid argument in E:\FreeJi\php\chats\my_frds.php on line 17
Warning: file_get_contents(../../accounts/full/amaan2 amaan2 /profile/status.txt): failed to open stream: Invalid argument in E:\FreeJi\php\chats\my_frds.php on line 18
请帮帮我!!!
试试 $_SERVER['DOCUMENT_ROOT'].'/accounts/full/'
请做
$name_url = '../../accounts/full/'.trim($frd_array[$i]).'/profile/name.txt';
为了去除多余的空格
$i = 0;
$name_url = '../../accounts/full/'.$frd_array[$i].'/profile/name.txt';
$name = file_get_contents($name_url);
$user_id = file_get_contents('../../accounts/full/'.$frd_array[$i].'/profile/user_id.txt');
$status = file_get_contents('../../accounts/full/'.$frd_array[$i].'/profile/status.txt');
echo "
<div class='frd_acc'>
<img class='c_avatar' src='../accounts/full/".$frd_array[$i]."/profile/avatar.png'>
<div class='c_name'>".$name."</div> <kbd class='c_user_id'>".$user_id."</kbd>
<div class='status'>".$status."</div>
</div>"
以上是我的 php 代码。当我执行此 php 脚本时,我收到以下错误:
Warning: file_get_contents(../../accounts/full/amaan2 amaan2 /profile/name.txt): failed to open stream: Invalid argument in E:\FreeJi\php\chats\my_frds.php on line 16
Warning: file_get_contents(../../accounts/full/amaan2 amaan2 /profile/user_id.txt): failed to open stream: Invalid argument in E:\FreeJi\php\chats\my_frds.php on line 17
Warning: file_get_contents(../../accounts/full/amaan2 amaan2 /profile/status.txt): failed to open stream: Invalid argument in E:\FreeJi\php\chats\my_frds.php on line 18
请帮帮我!!!
试试 $_SERVER['DOCUMENT_ROOT'].'/accounts/full/'
请做
$name_url = '../../accounts/full/'.trim($frd_array[$i]).'/profile/name.txt';
为了去除多余的空格