It does not work. When you click on a link, where do you want to execute a function? client-side or server-side? If you want to execute a function on the client side, then use javascript to do that. If you want to execute a function on the server side, you need to either change the url or do a form submission. Then you can execute the server-side function in that new page on the server-side.For example:<script language="javascript">
function clientFun()
{
  alert("hello world");
}
</script>
<form action="whatever.php" method="post" name="frmtest">
<input type=hidden name="hello" value="world">
</form>
<a href="javascript:void(clientFun())">Client Side</a><BR>
<a href="javascript:void(location.href='another.php')">Change Link</a><br>
<a href="javascript:void(document.frmtest.submit())">Submit a form</a>

解决方案 »

  1.   

    <!--假设这个页面叫submit.php-->
    <?php
        funcion hello()
            { echo "hello world!<br>"; }    if(isset($sbt)){
            hello();
        }else{
    ?>
    <script language=Javascript1.1>
    function form_submit(){
    document.test.submit();
    return;
    }
    </script>
    <form name=test action="submit.php" method=post>
    <input type=hidden name=sbt value="1">
    <a href="Javascript:form_submit()">执行服务器端函数</a>
    </form>
    <?php
        }
    ?>
      

  2.   

    建议使用javascript来做,php是服务器端的脚本语言,而用户点击连接是客户端的事件