有人可以告诉我这段代码有什么问题吗?
<?php
$user = $fgmembersite->UserFullName();
$handle = opendir('/users/$user/');
?>
这是错误消息:
opendir(/app/$user/) [function.opendir]: failed to open dir: No such file or directory in
答案 0 :(得分:3)
评估变量的双引号
$handle = opendir("/users/$user/");
What is the difference between single-quoted and double-quoted strings in PHP?
答案 1 :(得分:1)
在单引号中,$ user不会被解释为变量 - 在双引号中它将是try opedir(“/ users / $ user”)
答案 2 :(得分:1)
试试这个:
$handle = opendir("/users/$user/");