我問下 我已經(jīng)做了一個新聞模塊的 火車頭采集腳本 現(xiàn)在還想做其他的 模塊腳本 我應(yīng)該怎么做 我完全是復(fù)制的這個內(nèi)容
<?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ā)布者賬號 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'] = 9; //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';
// 驗證標(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;
第一行注明了,把news改成其它就可以了呀
開源是一種精神,但不是義務(wù),幫忙是情分,不幫也不要抱怨,建議大家多研究代碼、多閱讀代碼、多翻閱社區(qū)歷史問題!
回復(fù)@迅??蚣芗夹g(shù)-鄧芝 也就是說這個新聞模塊 和其他模塊這倆個腳本不能同時存在是嗎
改這里,
回復(fù)@黃老邪 我要同時入庫兩個莫快應(yīng)該怎么操作呢 也就是說 我想新聞模塊的腳本 也保留
新建另一個文件啊,例如caijitwo.php
回復(fù)@黃老邪

也就是說 我還得在新建兩個這樣的文件是嗎 然后 這兩個文件的名字 在從新命名下 是嗎
對,改一改名字就行了啊