【发布时间】:2014-11-03 14:52:07
【问题描述】:
我能够编写这个代码:
<?php
if(isset($_FILES['profile']) === true) {
if (empty($_FILES['profile']['name']) === true) {
echo 'Please choose a file!';
} else {
$allowed = array('jpg', 'jpeg', 'gif', 'png');
$file_name = $_FILES['profile']['name']; //file //line 75
$file_extn = strtolower(end(explode('.' , $file_name))); //line 76
$file_temp = $_FILES['profile']['tmp_name']; // line 77
if (in_array($file_extn, $allowed) === true) {
//upload file
} else {
echo 'incorrect file type. Allowed: ';
echo implode(' , ' , $allowed);
}
}
}
if (empty($user->data()->profile) === FALSE) {
echo '<img src="', $user->data()->profile, '" alt= "', $user->data()->profile, '\'s Profle Image">';
}
?>
然后突然出现以下错误:
严格的标准:在第 76 行的 C:\wamp\www\coding_exam\index.php 中只能通过引用传递变量
【问题讨论】:
-
请说清楚。
-
问题不清楚。不知道你在寻找什么。对此投反对票。保持微笑。
-
对不起,如果您不理解这个问题。我将修改问题...正如您在上面看到的代码...这是我在配置文件系统中上传图像文件的代码。
-
当我在本地主机上运行代码时,它显示“严格标准:只有变量应该在第 76 行的 C:\wamp\www\coding_exam\index.php 中通过引用传递”但输出是已经在那了。有什么办法可以摆脱严格的标准,还是需要根据我的代码进行修改。谢谢!
标签: php oop file-upload upload