<?PHPrequire_once' Rb.php '; $tableName= "link"; //Link DatabaseR::setup ("Mysql:host=localhost;dbname=hwibs_model", "Root", "" "); //Create a table (also referred to as instantiating a table) $handler= R::d ispense ($tableName); ##################################### Add ##################################### /*ibid. [Instantiate multiple tables simultaneously] list ($handler _1, $handler _2) = R::d ispenseall ("test_1,test_2"); */ //Object mode assignment to Field//:: Note that if the field does not exist, the corresponding field is automatically added after the store method, and the corresponding field type for the field is automatically set according to the field value $handler->name = "haha"; $handler->url = "Isxiugai"; $handler->plushtime = Time()-5000; //If you have an underlined field name, you can use the Hump method to name it, and it will be automatically converted to an underscore $handler->ismyname =false;//= is_my_name//execution, this static method returns the increment ID value (single) after adding success $inser _id= R::store ($handler); ##################################### Query ####################################//Gets the record handle (parameter 1 is the table name, Parameter 2 is the ID value), The return value is the object collection//If the ID does not exist, then return 0//Note that this gets to the handle that can be used for the delete operation $bean= R::load ($tableName, 4);//get a single $beans= R::loadall ($tableName,Array(1,2,3,4));//Get multiple ##################################### Update #####################################//1. Note that the only difference between the changes and the add is the ID, if the ID is not empty, it is modified, otherwise it is added! 2. If the ID does not exist, it will neither be added nor modified! Therefore, it is generally necessary to use load to determine whether there is a prior modification. foreach($beans as $k=$v){ $beans[$k]->url =Rand(100,5555);//test [Loop assigns a random number of URLs in each record object]} R:: StoreAll ($beans);//Perform modifications ##################################### Delete #####################################//delete single:: Success or failure is return null Var_dump(R::trash (R::load ($tableName, 1))); //Delete multiple:: If there is a non-existent, it will only delete the existing, success or failure is returned null Var_dump(R::trashall (R::loadall ($tableName,Array(117,118)))); ##################################### Other #####################################//clears all data in the table:: Equivalent to truncate, Because the self-increment pointer resets the//r::wipe ($tableName); Delete all the tables in the database, [no language function, to this hair]//var_dump (R::nuke ()); Close linkR::close ();?>