Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/299.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 单击html按钮时执行短代码_Php_Html_Shortcode - Fatal编程技术网

Php 单击html按钮时执行短代码

Php 单击html按钮时执行短代码,php,html,shortcode,Php,Html,Shortcode,我试图在点击按钮时调用一个快捷码。这段简短的代码更新了mysql colum。下面的代码我有没有工作。单击时,它所做的只是简单地将/“”添加到我的web地址,而不运行短代码 <div class="seat-btn"><a href="<?php my_custom_shortcode(); ?>" > CLICK TO OPEN SHORTCODE</a></div> 您不能像这样在前

我试图在点击按钮时调用一个快捷码。这段简短的代码更新了mysql colum。下面的代码我有没有工作。单击时,它所做的只是简单地将/“”添加到我的web地址,而不运行短代码

 <div class="seat-btn"><a href="<?php my_custom_shortcode(); ?>"   > CLICK TO OPEN SHORTCODE</a></div>


您不能像这样在前端执行php代码。PHP是一种服务器端语言。对于您的请求,建议使用Javascript执行短代码,或者向php页面发出Get请求,以便在服务器端执行该代码。

ah谢谢。我从另一篇stackover flow文章中得到了这一点,该文章将此作为解决方案。我觉得这不太对。让JS调用一个大家都知道其名称的.php文件是否存在安全风险?一般来说,您不应该在Get请求或Javascript代码中公开敏感信息,我在REST API security essentials中找到了这些信息,我认为这可能会有帮助:这是否回答了您的问题?不,谢谢你。我知道。其他一些关于叠加流的“解决方案”表明上述方法有效。