問題描述
在laravel中,我們可以通過Input::get('inputname')
獲取輸入值.我嘗試通過執行此操作來更改值 Input::get('inputname') = "new value";
.但是,我收到錯誤消息說Can't use function return value in write context
.
In laravel, we can get the input value via Input::get('inputname')
. I try to change the value by doing this Input::get('inputname') = "new value";
. But then, I get the error message saying Can't use function return value in write context
.
我們是否可以更改輸入值,以便稍后調用 Input::get('inputname')
時將獲得新的修改值?
Is it possible for us change the input value so that when later calling on Input::get('inputname')
will get the new amended value?
謝謝.
推薦答案
您可以使用 Input::merge()
替換單個項目.
You can use Input::merge()
to replace single items.
Input::merge(['inputname' => 'new value']);
或者使用Input::replace()
替換整個輸入數組.
Or use Input::replace()
to replace the entire input array.
Input::replace(['inputname' => 'new value']);
這是一個文檔鏈接
這篇關于Laravel 更改輸入值的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!