-1

嗨,朋友们,当我尝试提交图像时,我只是创建了一个 php favicon 图像生成器的演示,它以您选择的固定大小显示图像,但它也给出了一个错误,那就是

Strict Standards: Only variables should be passed by reference in 
C:\xampp\htdocs\demo123\index.php on line 40

第 40 行

$ext = end(explode(".",strtolower(trim($_FILES["image"]["name"]))));
4

2 回答 2

1

来自PHP.net

The following things can be passed by reference:

- Variables, i.e. foo($a)
- New statements, i.e. foo(new foobar())
- [References returned from functions][2]

所以改变你的代码如下

$data = trim($_FILES["image"]["name"]);
$data = strtolower($data);
$data = explode(".",$data);
$ext = end($data);

或者

$ext = pathinfo($_FILES["image"]["name"], PATHINFO_EXTENSION);
于 2012-11-04T11:05:12.870 回答
1

If you just want to suppress the error message, you can add an "@" sign in front of that line.

Although I think the message might be caused by trying to pass along $_FILES[], but I can't test it atm.

于 2012-11-04T11:06:57.980 回答