Blogger Information
Blog 19
fans 1
comment 0
visits 13313
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
2019.12.02前期基础知识梳理--php培训第九期线上班
涤尘
Original
892 people have browsed it
  1. <?php
  2. $site = 'php.cn';
  3. function get_site($webSite)
  4. {
  5. return $webSite . ' 欢迎您';
  6. }
  7. echo get_site($site);

  1. <?php
  2. // 变量名是name, 变量值的类型是字符串
  3. $name = 'Peter Zhu';
  4. $age = 30;
  5. $isMarried = true;
  6. echo '年龄' . $age . '<br>';
  7. echo '是否已婚: ' . $isMarried . '<br>';
  8. echo '姓名: ' . $name . '<br>';
  9. echo '我的姓是: ' . $name{0} . '<br>';
  10. print('年龄' . $age . '<br>');
  11. echo print('年龄' . $age . '<br>');
  12. print_r($name);
  13. echo '<br>';
  14. echo print_r($name, true);
  15. $data = range(1,20,2);
  16. echo '<pre>'. print_r($data, true) . '</pre>';
  17. var_export($name);
  18. echo '<br>';
  19. var_dump($name, $age, $isMarried);

  1. <?php
  2. // (一)索引数组
  3. $user[] = 101;
  4. $user[] = 'admin';
  5. $user[] = 'admin@php.cn';
  6. $user = [101, 'admin', 'admin@php.cn'];
  7. echo $user[2] . '<br>'; // email
  8. print_r($user);
  9. echo '<pre>' . print_r($user, true) . '</pre>';
  10. var_dump($user);
  11. echo '<hr>';
  12. $res = '';
  13. for ($i = 0; $i < count($user); $i++) {
  14. $res .= $user[$i] . ', ';
  15. }
  16. echo rtrim($res, ', ');
  17. echo '<hr>';
  18. $res = '';
  19. foreach ($user as $item) {
  20. $res .= $item . ', ';
  21. }
  22. echo rtrim($res, ', ');
  23. echo '<hr>';
  24. list($id, $name, $email) = $user;
  25. echo $id . '--' . $name . '--' . $email . '<br>';
  26. $str = implode(',', $user);
  27. echo $str, '<br>';
  28. $sql = "INSERT `users` SET `comment` = {$str};";
  29. $arr = explode(',', $str);
  30. print_r($arr);
  31. echo '<br>';
  32. /****************************************************************/
  33. // (二) 关联数组
  34. $user = ['id'=>101, 'name'=>'admin', 'email'=>'admin@php.cn'];
  35. echo $user['email'] . '<br>';
  36. print_r($user);
  37. var_dump($user);
  38. var_export($user);
  39. echo '<hr>';
  40. foreach ($user as $key=>$value) {
  41. echo '[' . $key . '] => ' . $value . '<br>';
  42. }
  43. $res = '';
  44. for ($i = 0; $i < count($user); $i++) {
  45. $res .= current($user) . ', ';
  46. next($user);
  47. }
  48. echo rtrim($res, ', ');
  49. echo '<hr>';
  50. extract($user);
  51. echo 'id = ' . $id . ', name = ' . $name . ', email = ' . $email . '<br>';
  52. $dsn = 'mysql:host=localhost;dbname=demo';
  53. $username = 'root';
  54. $password = 'root';
  55. $linkParams = compact('dsn', 'username', 'password');
  56. echo '<pre>'. print_r($linkParams, true) . '</pre>';
  57. echo '<hr>';
  58. return
  59. print_r(array_values($user));
  60. echo '<hr>';
  61. $chai = implode(',',$user);
  62. echo $chai, '<br>';
  63. $sql = "INSERT `users` SET `comment` = {$chai};";
  64. // echo exit;
  65. $arr = explode(',', $chai);
  66. print_r($arr);
  67. echo '<br>';

手抄







总结:通过部分梳理,发现一些漏掉的知识点,补足一些不太明白的知识点!努力!

Correcting teacher:天蓬老师天蓬老师

Correction status:qualified

Teacher's comments:这次是老师带着复习, 以后就要靠自己了
Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post