打印JavaScript的变量值用刀片模板Laravel一个PHP标识中 [英] Print JavaScript variable value inside a php tag using blade template in Laravel
本文介绍了打印JavaScript的变量值用刀片模板Laravel一个PHP标识中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
假设这是一个JS code,我想打印 ID
的价值。这里id是用一个值接收到的jq函数的变量。
Suppose this is a JS code and I want to print the value of id
. Here id is a variable with a value receiving into the jq function.
function follow_or_unfollow(id,action){
myUrl = "{{ action('FollowsController@show', 'id') }}" ;
}
如果我们mension '身份证'
它会显示ID字符串。
If we mension 'id'
it will show the id string.
PS。这里{{使用,因为它意味着作为PHP code叶片的模板。
PS. here {{ is using as it meant as php code in blade template.
现在我需要打印里面的PHP code中的脚本变量。
Now i need to print the script variable inside a php code.
推荐答案
只需使用{! $瓦尔!!}。
Just use {!! $vars !!}.
var link = {!! "'".url('string/'.$vars.'/string')."'" !!};
这篇关于打印JavaScript的变量值用刀片模板Laravel一个PHP标识中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文