缩进
修改理由:
此投稿已在 6年前 合并。
内容修改:
| Old | New | Differences |
|---|---|---|
| 25 | 25 | ``` |
| 26 | 26 | <?php |
| 27 | 27 | if($_GET){ |
| 28 | | |
| 28 | echo json_encode(['method'=>'get', 'params'=>$_GET]); | |
| 29 | 29 | } else if($_POST){ |
| 30 | | |
| 30 | echo json_encode(['method'=>'post', 'params'=>$_POST]); | |
| 31 | 31 | } else { |
| 32 | | |
| 32 | echo 'unknow method'; | |
| 33 | 33 | } |
| 34 | 34 | ``` |
| 35 | 35 | … | … |
| 37 | 37 | ### 1. 执行 GET 请求 |
| 38 | 38 | ``` |
| 39 | 39 | axios.get('http://localhost/test.php?id=123') |
| 40 | .then(response => console.log(response.data)) // | |
| 40 | .then(response => console.log(response.data)) // 请求的返回结果存放在response.data | |
| 41 | 41 | .catch(error => console.log(error)) |
| 42 | 或者如果拼接的参数比较多时可以这样传参 | |
| 42 | ||
| 43 | // 或者如果拼接的参数比较多时可以这样传参 | |
| 43 | 44 | axios.get('http://localhost/test.php', { |
| 44 | 45 | params: { |
| 45 | 46 | id: 123, |
关于 LearnKu