api file is error
我用這里的辦法做了個(gè)新自定義接口頁(yè)面
http://www.apdwn.com/wenda/24462.html
之前使用正常的
現(xiàn)在突然訪問(wèn)接口頁(yè)面 www.xxxx.com/go.php?id=2910 的時(shí)候,怎么提示
api file is error
請(qǐng)問(wèn)這是什么原因呢
是因?yàn)榘姹旧?jí)了嗎?應(yīng)該怎么處理
下面是自定義頁(yè)面的代碼文件如下
根目錄go.php
<?php
/**
* 自定義程序
*/
define('IS_API', basename(__FILE__, '.php')); // 項(xiàng)目標(biāo)識(shí)
define('SELF', pathinfo(__FILE__, PATHINFO_BASENAME)); // 該文件的名稱
require((dirname(__FILE__)).'/index.php'); // 引入主文件插件目錄/dayrui/My/Api/go.php
<?php
/**
* 自定義程序的控制器代碼
這里寫php代碼,基于控制器類
*/
$id = intval($_GET['id']);
$data = \Phpcmf\Service::M()->table_site("sp")->get($id); // 這里吧demo改成你的模塊目錄名稱
$url = $data['sptklj'];
// 輸出url看看對(duì)不對(duì),這里可以改進(jìn)為301跳轉(zhuǎn)等等,自由發(fā)揮
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width">
<meta name="robots" content="noindex, nofollow" />
<meta http-equiv="Refresh" content="0.1;url=<?php echo $url;?>"/>
<script>
var _hmt = _hmt || [];
(function() {
var hm = document.createElement("script");
hm.src = "https://#/hm.js?a1c4b380bbc0d2125ba394767c5ec8f4";
var s = document.getElementsByTagName("script")[0];
s[xss_clean].insertBefore(hm, s);
})();
</script>
</head>
<body>
<div style="width:300px;height:100px;margin:0 auto;padding:50px 0; text-align:center">頁(yè)面跳轉(zhuǎn)中,敬請(qǐng)稍候...</div>
</body>
</html>
/dayrui/My/Api/go.php命名改為 /dayrui/My/Api/Go.php
開(kāi)源是一種精神,但不是義務(wù),幫忙是情分,不幫也不要抱怨,建議大家多研究代碼、多閱讀代碼、多翻閱社區(qū)歷史問(wèn)題!
參考文檔:《自定義入口程序》 看吧,要大寫開(kāi)頭