.js文件中的php标签 [英] php tags in .js file

查看:204
本文介绍了.js文件中的php标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何输入<?回声你好; 。> 在.js文件中。
这是一个jquery应用程序,因此是js文件。

How do I enter a <? echo "hello"; ?> in a .js file. This is a jquery app, therefore the js file.

谢谢
Jean

Thanks Jean

推荐答案

好的伙伴在这里就是答案

问:我想输入一个值变量到.js文件中,不允许使用php标记,js会抛出错误。

The Q: I want to input a value for a variable into a .js file, php tags are not permitted and the js would throw an error.

A:写一个

< script> < ;? var value_pass = echohello; ?> < / script> 在所述.js文件之前

<script> <? var value_pass = echo "hello"; ?> </script> before the said .js file

在所述.js文件中
var value = value_pass;

In the said .js file var value=value_pass;

因此无需任何ob_end_flush。

So there is no need to have any of the ob_end_flush.

如果这不可行,请告诉我。

If this is not viable please let me know.

谢谢
Jean

Thanks Jean

这篇关于.js文件中的php标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆