1、在宝塔配置文件中找到以下语句
access_log /www/******
error_log /www/******
替换成:
add_header Access-Control-Allow-Origin *;
add_header Access-Control-Allow-Headers "Origin, X-Requested-With, Content-Type, Accept";
add_header Access-Control-Allow-Methods "GET, POST, OPTIONS";
access_log /www/******
error_log /www/******
2、用php语句建一个接口
<?php
$cfg_NotPrintHead = false;
header("Content-Type: text/html; charset=utf-8");
include_once (dirname(__FILE__)."/include/common.inc.php");
error_reporting(E_ALL || ~E_NOTICE);
require_once(DEDEINC.'/json.class.php');
$reval = array();
$dsql->SetQuery("SELECT id,title FROM `de_kd_archives` where typeid='栏目id' and LIMIT 5");
$dsql->Execute('me');
while ($row = $dsql->GetArray('me')) {
//$row['title'] = gb2utf8($row['title']);
$reval[] = $row;
}
$json = new Services_JSON(SERVICES_JSON_SUPPRESS_ERRORS);
echo $json->encode($reval);
?>
标签: 宝塔
上面是“如果用宝塔实现dedecms织梦接口调用”的全面内容,想了解更多关于 织梦cms 内容,请继续关注web建站教程。
当前网址:https://ipkd.cn/webs_784.html
workflows工作流
图生图生成动漫效果ComfyUI工作流
一条精致透明的朱红色水晶龙
一只可爱的猫骑着一匹可爱的马ComfyUI工作流
一座古老的石阶,旁边有一棵树
哈利波特魔法ComfyUI工作流
一个孤独的身影在未来主义城市
一个超现实和超现实的场景,在森林中心有一座蛇形的房子
一只黑色的小猫在童话森林里嗅着一朵发光的外星花
猜你喜欢
声明:本站提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请发送到邮箱:admin@ipkd.cn,我们会在看到邮件的第一时间内为您处理!