Home > Backend Development > PHP Tutorial > PHP learning record experience two

PHP learning record experience two

小云云
Release: 2023-03-20 21:44:02
Original
1071 people have browsed it

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":

<?phpecho str_replace("world","Shanghai","Hello world!");?>
Copy after login

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[&#39;page&#39;];
  $page1=($page-1)*10;
  $sql="select * from gh_09609b5c87c2.wxch_user order by uid desc limit $page1,10 ";
Copy after login

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!

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