PHP免责声明脚本

时间:2010-10-30 16:00:20

标签: php javascript

我想知道:这个JavaScript代码的PHP等价物是什么:

window.onload = initAll;

function initAll() {
  document.getElementById("redirect").onclick = clickHandler;
}

function clickHandler() {

  if(this.toString().indexOf("wapcreate") < 0){
    window.location = "ex.html";
  }

  return false;
}

我希望从我的服务器获取所有外部链接,然后将用户引导至免责声明页面

1 个答案:

答案 0 :(得分:0)

没有PHP等价物,因为PHP在服务器上执行,而Javascript在客户端执行。 PHP无法处理onclick事件。

但是如果要重定向页面,请尝试设置如下标题:

header( 'Location: ex.html' );