在javascript警报中编写php [英] write php inside javascript alert

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

问题描述

我通过以下方式在JS内编写PHP

I write PHP inside JS in the following way

alert(<?php echo __("Error-login") ?>);

echo __( Error-login)与xml关联以使用symfony转换为两种语言,但现在不起作用。

echo__("Error-login") correlates with an xml to translate in two languages ​​with symfony, but now it does not work.

我该如何解决呢?

推荐答案

alert()调用中缺少引号。

alert('<?php echo __("Error-login") ?>'); 

这篇关于在javascript警报中编写php的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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