du3669 2015-10-02 23:18
浏览 59
已采纳

用户使用Post方法单击链接时运行PHP函数

What would be the cleanest way to run the PHP code below but instead of $_GET, using $_POST instead?

<?php
function run_my_function() {
    echo 'I just ran a PHP function!';
}
if (isset($_GET['run'])) {
    run_my_function();
}
?>
<html>
<body>
    <p>Hello there! <a href="?run">Run a PHP function.</a></p>
</body>
</html>
  • 写回答

2条回答 默认 最新

  • du5407 2015-10-02 23:22
    关注

    NO, you cannot send post request from anchor tag. you will have to use <form>

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?