如何在laravel控制器中获得标签值

时间:2021-05-07 04:17:12

Here is my html code :

这是我的HTML代码:

<label value="2" name="myLabel">Hello</label>

Here is my laravel controller code :

这是我的laravel控制器代码:

$temp=Input::get("myLabel");

I am not able to get the value of this label as this is not an input type control, please let me know the answer.

我无法获得此标签的值,因为这不是输入类型控件,请让我知道答案。

Thanks

2 个解决方案

#1


1  

Use Hiddenfield with of label and set the value of that hiddenfield equalto the label.

使用带有标签的Hiddenfield并将该hiddenfield的值设置为等于标签。

#2


0  

try to use id attribute in your label. It works on me. https://www.w3schools.com/tags/tag_label.asp

尝试在标签中使用id属性。它适用于我。 https://www.w3schools.com/tags/tag_label.asp

#1


1  

Use Hiddenfield with of label and set the value of that hiddenfield equalto the label.

使用带有标签的Hiddenfield并将该hiddenfield的值设置为等于标签。

#2


0  

try to use id attribute in your label. It works on me. https://www.w3schools.com/tags/tag_label.asp

尝试在标签中使用id属性。它适用于我。 https://www.w3schools.com/tags/tag_label.asp