PHP里如何让自己网页的内容防止被复制的代码?

请高人帮忙。小第初学,跪谢了
2025-04-05 00:13:55
推荐回答(1个)
回答1:

  1、在不想被复制内容的php页面中添加引用

  2、同时在网站文件夹中放入nocopy.js文件,当前../nocopy.js表示nocopy.js文件在根文件夹中

  3、nocopy.js中的文件内容是:

  var omitformtags=["input", "textarea", "select"]
  omitformtags=omitformtags.join("|")

  function disableselect(e){
  if (omitformtags.indexOf(e.target.tagName.toLowerCase())==-1)
  return false
  }

  function reEnable(){
  return true
  }

  if (typeof document.onselectstart!="undefined")
  document.onselectstart=new Function ("return false")
  else{
  document.onmousedown=disableselect
  document.onmouseup=reEnable
  }