Home > Backend Development > PHP Tutorial > discuz的插件是如何操作数据库的

discuz的插件是如何操作数据库的

WBOY
Release: 2016-06-13 12:04:29
Original
1385 people have browsed it

discuz的插件是怎么操作数据库的?
add.inc.php:

<br /><?php<br />if(!defined('IN_DISCUZ')) {<br />        exit('Access Denied');<br />}<br />$q1 = $_REQUEST['q1']; <br />$addtime = time();<br /><br />	$insert_array = array(<br />			'baankid'=>$q1,<br />	);<br />	$cone = DB::insert('pre_xyk',$insert_array);<br />?> <br />
Copy after login


echo $q1; 这样是有输出的,但是怎么写不进数据的?

DZ的插件是怎么操作数据库的?

add.inc.php怎么写才正确?先谢谢了!
------解决方案--------------------
require './source/class/class_core.php';<br />C::app()->init();<br /><br />$insert_array = array(<br />	'classname'=>'test',<br />	'uid'=>1,<br />	'dateline'=>time()<br />);<br />if(DB::insert('home_class',$insert_array)){<br />	echo 'ok';<br />}/*<br />ok<br />*/<br />
Copy after login

插入不成功discuz应该报错,怎么没有错误提示?
猜测:
1、class_core.php没有引入,并且没有初始化,不能使用DB调用
2、pre_xyk是表全名,默认是不要pre_前缀(若设置有)

------解决方案--------------------
不成功总有提示吧,就是错误报告
你单独访问这个页面试试,成不成功
------解决方案--------------------
..是上一级目录开始查找
.是当前目录开始查找

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template