作者热门文章
- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
检查这段代码:
$last = end($p = explode('/', $someString));
收到此通知:
Only variables should be passed by reference
我真的很困惑,因为 $p
是一个变量。
最佳答案
end()
需要一个变量,而不是一个引用。在你的例子中 $p = explode('/', $someString)
不是一个变量,它是一个赋值。作为documentation说:
This array is passed by reference because it is modified by the function. This means you must pass it a real variable and not a function returning an array because only actual variables may be passed by reference.
你应该这样做:
$p = explode('/', $someString);
$last = end($p);
关于php - 为什么我会收到 "Only variables should be passed by reference"错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20776017/
我是一名优秀的程序员,十分优秀!