Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/240.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 当我使用laravel DB类时,我得到了一个错误:找不到列名_Php_Laravel - Fatal编程技术网

Php 当我使用laravel DB类时,我得到了一个错误:找不到列名

Php 当我使用laravel DB类时,我得到了一个错误:找不到列名,php,laravel,Php,Laravel,大家好 我在学习laravel DB类时遇到了一些问题 当我像 $content = DB::table($name)->pluck('onoma','epitheto'); 一切正常。但是使用内爆()函数,我得到了这个错误 未找到列:1054未知列“onoma”,“字段中的修饰语” 列表“(SQL:从xrister中选择'onoma'、”修饰语“) 如果您使用的是PHP5.6+,则可以使用splat操作符: $arr = ['onoma', 'epitheto']; $conte

大家好 我在学习laravel DB类时遇到了一些问题

当我像

$content = DB::table($name)->pluck('onoma','epitheto');
一切正常。但是使用
内爆()
函数,我得到了这个错误

未找到列:1054未知列“onoma”,“字段中的修饰语” 列表“(SQL:从
xrister
中选择
'onoma'、”修饰语“


如果您使用的是PHP5.6+,则可以使用
splat
操作符:

 $arr = ['onoma', 'epitheto'];

 $content =  DB::table($name)->pluck(...$arr);
如果没有,则可以执行以下操作:

 $arr = ['onoma', 'epitheto'];

 $content = call_user_func_array([ DB::table($name), 'pluck' ], $arr);

如果您使用的是PHP5.6+,则可以使用
splat
操作符:

 $arr = ['onoma', 'epitheto'];

 $content =  DB::table($name)->pluck(...$arr);
如果没有,则可以执行以下操作:

 $arr = ['onoma', 'epitheto'];

 $content = call_user_func_array([ DB::table($name), 'pluck' ], $arr);

在工作正常的示例中,您将向该方法调用传递2个参数

pluck($column,$key)
2个独立的参数

pull('column','key')
2个单独的字符串

在一个不起作用的参数中,将单个字符串作为1个参数传递。出于某种原因,您正在告诉
pluck
使用名为
'onoma'、'epitheto'
的单列


pluck(“'onoma','epitheto')
1个字符串,1个参数

在工作正常的示例中,您向该方法调用传递了2个参数

pluck($column,$key)
2个独立的参数

pull('column','key')
2个单独的字符串

在一个不起作用的参数中,将单个字符串作为1个参数传递。出于某种原因,您正在告诉
pluck
使用名为
'onoma'、'epitheto'
的单列


pluck('onoma','epitheto')
1个字符串,1个参数

尝试一次
$data=“””。内爆(“,”,$arr)。”
删除所有空格Sagain im getting same error'列未找到:1054未知列“onoma”,字段列表中的“epitheto”(SQL:select
'onoma','epitheto'
from
xrister
)是否删除了所有空格?请尝试一次
$data=“”。内爆(“,”,“,$arr”)
删除所有空格Sagain im getting same error'Column not found:1054未知列“onoma”,“field list”中的“epitheto”(SQL:select
“onoma”,“epitheto”
from
xrister
)“您删除了所有空格吗?非常感谢它与splat运算符一起工作还是非常感谢它与splat运算符一起工作?”