modified: application/config.php

modified:   application/index/controller/Index.php
	new file:   application/index/controller/News.php
	modified:   application/route.php
master
fengyuexingzi 8 years ago
parent b50ae14b13
commit 109dd6d5ca

@ -43,7 +43,7 @@ return [
// 是否开启多语言
'lang_switch_on' => false,
// 默认全局过滤方法 用逗号分隔多个
'default_filter' => 'htmlspe',
'default_filter' => 'htmlspecialchars',
// 默认语言
'default_lang' => 'zh-cn',
// 应用类库后缀

@ -31,6 +31,16 @@ class Index extends Base
public function tree()
{
$arr = [];
$arr1 = [];
$arr2 = [];
$arr3 = ['king'=>'best'];
//$arr = array_merge($arr1, $arr2, $arr3);
var_dump($arr);
}
public function hello()
{
var_dump(input());
}
}

@ -0,0 +1,40 @@
<?php
/**
* Created by PhpStorm.
* User: Wind
* Date: 2017/10/27
* Time: 9:25
*/
namespace app\index\controller;
use app\common\controller\Base;
use think\Url;
class News extends Base
{
public function read($id)
{
$html = "
<form action= '" . Url::build('/new/5', null, $this->request->ext(), false) . "' method='post'>
<input type='text' name='name'>
<input type='text' name='pwd'>
<input type='submit'>
</form>
";
echo $html;
$arr = $this->request->param();
var_dump($id);
var_dump($arr);
}
public function update()
{
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
var_dump($_REQUEST);
die;
} else {
echo '无效的请求';
}
}
}

@ -8,14 +8,27 @@
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------
use think\Route;
//Route::rule(['new','new/:id'],'index/News/read');
//Route::rule('/new/:k', 'index/News/read/','GET');
//Route::rule('/new/:k', 'index/News/update/','POST');
return [
'new/:id' => [
//'News/read?status=1&app_id=5',
'News/read',
['method' => 'get|post','ext' => 'shtml'],
['id' => '\w+'],
],
'__pattern__' => [
'name' => '\w+',
],
'[hello]' => [
':id' => ['index/hello', ['method' => 'get'], ['id' => '\d+']],
'[hello]' => [
':id' => ['index/hello', ['method' => 'get'], ['id' => '\d+']],
':name' => ['index/hello', ['method' => 'post']],
],
];

Loading…
Cancel
Save