PHP Code Chapter (3) — Common Methods

Time:2019-8-11

Continuous updates under the module, PHP commonly used methods, welcome to leave a message!

Recursive deletion of all files and folders in a specified directory
* *

2. Common operation of database

// Insert a piece of data
INSERT INTO ims_stat_rule (rid,hit) VALUES (351,990);
// Delete a piece of data
DELETE FROM ims_nets_hjk_applyfor WHERE member_id = 49483;
// Modify a piece of data
update ims_nets_hjk_members set level = 4 where id = 100248;
// Query data
select * from ims_nets_hjk_members where memberid = 18978;

3. ThinkPHP 5.0 Common Operations

// within query interval
$device_string = $db->table('ims_nets_hjk_devices')
                    ->where('device_id',['>=',$k],['<=',$j],'AND')
                    ->where('status',0)
                    ->field('device_id')
                    ->limit(50)
                    ->select();

4. Common functions of PHP

// Array to string
$str = (',',$device_string);
// String Rotation Array
$arr = (',',$device_string);