Php 当我使用laravel DB类时,我得到了一个错误:找不到列名
大家好 我在学习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
$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'
fromxrister
)是否删除了所有空格?请尝试一次$data=“”。内爆(“,”,“,$arr”)
删除所有空格Sagain im getting same error'Column not found:1054未知列“onoma”,“field list”中的“epitheto”(SQL:select“onoma”,“epitheto”
fromxrister
)“您删除了所有空格吗?非常感谢它与splat运算符一起工作还是非常感谢它与splat运算符一起工作?”