How does the discuz plug-in operate databases? Add. inc. php:
$q1,);$cone = DB::insert('pre_xyk',$insert_array);?>
Echo $ q1; there is output, but how can I not write data?
How does the DZ plug-in operate databases?
How can I write add. inc. php correctly? Thank you!
Reply to discussion (solution)
require './source/class/class_core.php';C::app()->init();$insert_array = array('classname'=>'test','uid'=>1,'dateline'=>time());if(DB::insert('home_class',$insert_array)){echo 'ok';}/*ok*/
If the insertion fails, discuz should report an error. why is there no error prompt?
Guess:
1. class_core.php is not introduced and is not initialized. it cannot be called using DB.
2. pre_xyk indicates the full name of the table. the default value is not the prefix (if any)
init(); $insert_array = array( 'baankid'=>1,);if(DB::insert('xyk',$insert_array)){ echo 'ok';}?>
Even so, no data is written,
Plug-in blocks do not need to define add. inc. php?
If it fails, there will always be a prompt, that is, an error report.
You can try to access this page separately.
Access this page separately without any output, blank
include '../source/class/class_core.php';$discuz = & discuz_core::instance();$discuz->init();print_r($_G);
In this case, there is a variable output. why:
Include '../source/class/class_core.php ';
../Is there output./Is there no output?
Require '.. /.. /.. /source/class/class_core.php '; // introduce the system core file $ discuz = & discuz_core: instance (); // the following code creates and initializes an object $ discuz-> cachelist = $ cachelist; $ discuz-> init (); // The above is the core code that calls the discuz public execution class and so on // write the database $ arr = array (); $ arr ['userid'] = $ userid; $ count1 = DB :: insert ('xyk', $ arr );
This can be written, and I don't understand why:
Require '../.../../source/class/class_core.php'; // introduce the system core file
In this way, you cannot:
Require './source/class/class_core.php'; // introduce the system core file
Path not set?
.. Is the first-level directory to start searching
Is the current directory to start searching
Thank you very much for your patience at jam00. thank you!
However, none of the plug-ins I see will use ../../../
Both./and can work normally.
The directory layers are the same. why must I use ../../../? Why not use an absolute path?