Skip to content

Commit 73d60b6

Browse files
committed
chapter-4
1 parent 5193abe commit 73d60b6

File tree

5 files changed

+82
-2
lines changed

5 files changed

+82
-2
lines changed

chapter-4/Application/Home/Conf/config.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,7 @@
33
* config.php
44
*/
55
return array(
6-
'ACTION_SUFFIX' => 'Action', // 操作方法后缀
6+
// 'ACTION_SUFFIX' => 'Action', // 操作方法后缀
7+
'URL_MODEL' => 3,
8+
'URL_CASE_INSENSITIVE' => true
79
);
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?php
2+
/**
3+
* Project: thinkphp-inaction
4+
* User: xialeistudio<1065890063@qq.com>
5+
* Date: 2016-02-18
6+
*/
7+
namespace Home\Controller;
8+
9+
use Think\Controller;
10+
11+
class EmptyController extends Controller
12+
{
13+
public function index()
14+
{
15+
$name = CONTROLLER_NAME;
16+
$this->view($name);
17+
}
18+
19+
private function view($name)
20+
{
21+
echo 'name:' . $name;
22+
}
23+
}

chapter-4/Application/Home/Controller/IndexController.class.php

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,27 @@ class IndexController extends Controller
77
{
88
public function index()
99
{
10-
echo $_GET['from'];
10+
$this->redirect('login', 'role=admin', 3, '请登录');
11+
}
12+
13+
public function bind($id = 1)
14+
{
15+
echo U('Blog/view', array('id' => 1), 'shtml');
16+
}
17+
18+
public function login()
19+
{
20+
if (IS_POST)
21+
{
22+
echo '当前为POST请求方法,需要处理登录逻辑';
23+
}
24+
else if (IS_GET)
25+
{
26+
echo '当前为空GET请求方法,需要显示登录页面';
27+
}
28+
else
29+
{
30+
echo '非法请求';
31+
}
1132
}
1233
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?php
2+
/**
3+
* Project: thinkphp-inaction
4+
* User: xialeistudio<1065890063@qq.com>
5+
* Date: 2016-02-18
6+
*/
7+
namespace Home\Controller;
8+
9+
use Think\Controller;
10+
11+
class UserController extends Controller
12+
{
13+
public function _empty($name)
14+
{
15+
$this->view($name);
16+
}
17+
18+
private function view($name)
19+
{
20+
echo 'name:'.$name;
21+
}
22+
}

chapter-4/post.html

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<title>Post</title>
6+
</head>
7+
<body>
8+
<form action="http://localhost/thinkphp-inaction/chapter-4/Home/Index/login" method="post">
9+
<button>提交</button>
10+
</form>
11+
</body>
12+
</html>

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy