我按照火車頭采集內(nèi)容制作的腳本 為什么發(fā)布不成功呢 我是這樣做的


代碼的內(nèi)容 是這樣的
<?php
/**
* 數(shù)據(jù)采集
*/
define('IS_API', basename(__FILE__, '.php')); // 項(xiàng)目標(biāo)識(shí)
define('SELF', pathinfo(__FILE__, PATHINFO_BASENAME)); // 該文件的名稱
require('../index.php'); // 引入主文件<?php
$this->_module_init('news'); // news 是模塊目錄
if ($_GET['action'] == 'category') {
// 顯示欄目
foreach ($this->module['category'] as $t) {
if ($t['child'] == 0 && $t['tid'] == 1) {
echo '<h1>'.$t['name'].'<=>'.$t['id'].'</h1>'.PHP_EOL;
}
}
} else {
// 入庫數(shù)據(jù)
$data = $_REQUEST;
// 發(fā)布者id 1
$data['uid'] = 1;
// 發(fā)布者賬號(hào) admin
$data['author'] = 'admin';
// 主表字段
$fields[1] = $this->get_cache('table-'.SITE_ID, $this->content_model->dbprefix(SITE_ID.'_'.MOD_DIR));
$cache = $this->get_cache('table-'.SITE_ID, $this->content_model->dbprefix(SITE_ID.'_'.MOD_DIR.'_category_data'));
$cache && $fields[1] = array_merge($fields[1], $cache);
// 附表字段
$fields[0] = $this->get_cache('table-'.SITE_ID, $this->content_model->dbprefix(SITE_ID.'_'.MOD_DIR.'_data_0'));
$cache = $this->get_cache('table-'.SITE_ID, $this->content_model->dbprefix(SITE_ID.'_'.MOD_DIR.'_category_data_0'));
$cache && $fields[0] = array_merge($fields[0], $cache);
// 去重復(fù)
$fields[0] = array_unique($fields[0]);
$fields[1] = array_unique($fields[1]);
$save = [];
// 主表附表歸類
foreach ($fields as $ismain => $field) {
foreach ($field as $name) {
isset($data[$name]) && $save[$ismain][$name] = $data[$name];
}
}
if (!$data['catid']) {
exit('欄目為空');
}
$save[1]['uid'] = $save[0]['uid'] = $data['uid'];
$save[1]['catid'] = $save[0]['catid'] = $data['catid'];
$save[1]['url'] = '';
$save[1]['status'] = 1; //9表示正常發(fā)布,1表示審核里面
$save[1]['hits'] = 0;
$save[1]['displayorder'] = 0;
$save[1]['link_id'] = 0;
$save[1]['inputtime'] = $save[1]['updatetime'] = SYS_TIME + rand(0, 7200);
$save[1]['inputip'] = '127.0.0.1';
// 驗(yàn)證標(biāo)題重復(fù)
if ($this->content_model->table(SITE_ID.'_'.MOD_DIR)->where('title', $save[1]['title'])->counts()) {
echo '重復(fù)';exit;
}
$rt = $this->content_model->save_content(0, $save);
if ($rt['code']) {
exit('成功');
} else {
exit('失敗');
}
}
exit;
寫法沒有問題,發(fā)布不成功提示什么錯(cuò)誤,看看結(jié)果
開源是一種精神,但不是義務(wù),幫忙是情分,不幫也不要抱怨,建議大家多研究代碼、多閱讀代碼、多翻閱社區(qū)歷史問題!
回復(fù)@官方研發(fā)技術(shù)-西門
500錯(cuò)誤是習(xí)慣故障,你看看,系統(tǒng)-日志管理-錯(cuò)誤日志
開源是一種精神,但不是義務(wù),幫忙是情分,不幫也不要抱怨,建議大家多研究代碼、多閱讀代碼、多翻閱社區(qū)歷史問題!
回復(fù)@官方研發(fā)技術(shù)-西門
<?php defined('SYSTEMPATH') || exit('No direct script access allowed'); ?> ERROR - 2021-01-08 09:31:33 --> BaiduApiToken: ERROR - 2021-01-08 09:38:17 --> BaiduApiToken: ERROR - 2021-01-08 09:38:52 --> http://wz.entem.cn/index.php?s=member:模板文件不存在(/wwwroot/xunruiCMS/template/pc/newmoban/member/header.html) ERROR - 2021-01-08 09:45:28 --> BaiduApiToken: ERROR - 2021-01-08 09:45:55 --> BaiduApiToken: ERROR - 2021-01-08 09:47:58 --> BaiduApiToken: ERROR - 2021-01-08 09:56:15 --> BaiduApiToken: CRITICAL - 2021-01-08 10:25:24 --> Call to undefined method Phpcmf\Model\Content::save_content() #SQL:SELECT COUNT(*) AS `numrows` FROM `dr_1_news` WHERE `title` = '你好' #URL:http://wz.entem.cn/api/caiji.php?action=post #AGENT: #REFERER:http://wz.entem.cn/ #0 /wwwroot/xunruiCMS/dayrui/Core/Controllers/Api/Home.php(35): require() #1 /wwwroot/xunruiCMS/dayrui/System/CodeIgniter.php(918): Phpcmf\Controllers\Api\Home->index() #2 /wwwroot/xunruiCMS/dayrui/System/CodeIgniter.php(404): CodeIgniter\CodeIgniter->runController() #3 /wwwroot/xunruiCMS/dayrui/System/CodeIgniter.php(312): CodeIgniter\CodeIgniter->handleRequest() #4 /wwwroot/xunruiCMS/dayrui/Fcms/Init.php(377): CodeIgniter\CodeIgniter->run() #5 /wwwroot/xunruiCMS/index.php(50): require('/wwwroot/xunrui...') #6 /wwwroot/xunruiCMS/api/caiji.php(9): require('/wwwroot/xunrui...') #7 {main}程序版本低了,需要4.3.13,函數(shù)不支持了
開源是一種精神,但不是義務(wù),幫忙是情分,不幫也不要抱怨,建議大家多研究代碼、多閱讀代碼、多翻閱社區(qū)歷史問題!
cms框架版本低了