Home > Article > Backend Development > PHP learning record experience two
We have shared PHP learning record experience one with you in the previous article. In this article, we will continue to share PHP learning record experience two with you. We hope it can help everyone.
12. When using thinkPHP, when assembling the save sql statement, you cannot use save($status['save']); you must use save($status);
13. (int) parameter Put (int) in front of the parameter to force conversion to int type. Other types are also available. Change the type.
14. json_decode() accepts a JSON encoded string and converts it into a PHP variable, array mode.
json_encode() JSON encodes variables
15. The str_replace() function replaces the character "world" in the string "Hello world!" with "Shanghai":
60393fe17a4cde20911161c1cd98ea82
16. is_array() determines whether the variable type is an array type.
17. The array() function is used to create an array.
18. serialize — Generate a storable representation of a value
19. var_export — Output or return a string representation of a variable
20. PHP file_put_contents function (' wxid.log', "[".time_format(time(),'Y-m-d H:i:s').'121'.$SendUser."]\n".var_export($map,true)."\n" ,FILE_APPEND);
is used to output logs and print logs. wxid.log is a file that stores logs. $map is an array containing the information you want to see.
FILE_APPEND is Added viewing methods.
21.
$page=$_GET['page']; $page1=($page-1)*10; $sql="select * from gh_09609b5c87c2.wxch_user order by uid desc limit $page1,10 ";
Transmit paging information, use limit page number, and display the quantity on 1 page, use order by and add the sort field to sort by.
Related recommendations:
PHP learning record sharing one
The above is the detailed content of PHP learning record experience two. For more information, please follow other related articles on the PHP Chinese website!