闲者博客 - 页面 2022-02-26T17:40:48+08:00 Typecho https://bk1314.com/feed/atom/tag/%E9%A1%B5%E9%9D%A2/ <![CDATA[一段JS读取内容 这样前台静态加载到页面 ]]> https://bk1314.com/47.html 2022-02-26T17:40:48+08:00 2022-02-26T17:40:48+08:00 飞鱼 http://www.typecho.org function setPublicKey() { $.getJSON('zzs.json', function(packJson){ var strjson = ""; for(var p in packJson){ strjson+= packJson[p].key+"<br>"; } var mazey=document.getElementById("jg"); mazey.innerHTML="这里是返回内容:<br><br>"+strjson; }); } ]]> <![CDATA[PHP获取当前页面URL]]> https://bk1314.com/39.html 2022-02-25T18:51:51+08:00 2022-02-25T18:51:51+08:00 飞鱼 http://www.typecho.org function curPageURL() { $pageURL = 'http'; if (!empty($_SERVER['HTTPS'])) {$pageURL .= "s";} $pageURL .= "://"; if ($_SERVER["SERVER_PORT"] != "80") { $pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"]; } else { $pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"]; } return $pageURL; } echo curPageURL(); ]]>