We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"compact(): Undefined variable: source" 在/modules/Translator/start.php 这个文件报这个错 \Form::macro('translate', function($attrs) { $value = $this->getValue($attrs); $id = $this->getId($attrs); $name = $this->getAttribute($attrs, 'name'); $button = $this->getAttribute($attrs, 'button', trans('translator::translator.button'));
$options = [ 'url' => $this->getAttribute($attrs, 'url', route('translator.translate')), 'source' => $this->getAttribute($attrs, 'source', ''), 'format' => $this->getAttribute($attrs, 'format', ''), 'from' => $this->getAttribute($attrs, 'from', ''), 'to' => $this->getAttribute($attrs, 'to', ''), 'maxlength' => $this->getAttribute($attrs, 'maxlength', '', false), 'separator' => $this->getAttribute($attrs, 'separator', ''), ]; return $this->toHtmlString( $this->view->make('translator::field.translate')->with(compact('name', 'id', 'value', 'attrs', 'source', 'button', 'options'))->render()//这句话报错 提示找不到source变量 );
});
解决方法定义一个$source='';变量即可 我的php环境时php7.3.6
The text was updated successfully, but these errors were encountered:
看到了,这里应该是有错误,我检查一下为什么我这里没报错
Sorry, something went wrong.
解决方案:去掉compact中的source
$this->view->make('translator::field.translate')->with(compact('name', 'id', 'value', 'attrs', 'source', 'button', 'options'))->render()
改为
$this->view->make('translator::field.translate')->with(compact('name', 'id', 'value', 'attrs', 'button', 'options'))->render()
直接传递source是之前版本的做法,后面版本已经改成了通过options 传递,这里忘记修改了,因为我这里先前测试中一直都没报错所以并未发现,感谢反馈,后续版本将修正
版本号更新,修复bug #14
f4b7f2c
No branches or pull requests
"compact(): Undefined variable: source"
在/modules/Translator/start.php 这个文件报这个错
\Form::macro('translate', function($attrs) {
$value = $this->getValue($attrs);
$id = $this->getId($attrs);
$name = $this->getAttribute($attrs, 'name');
$button = $this->getAttribute($attrs, 'button', trans('translator::translator.button'));
});
解决方法定义一个$source='';变量即可 我的php环境时php7.3.6
The text was updated successfully, but these errors were encountered: