Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
yuenblue
PhpDemo
提交
47def4a5
P
PhpDemo
项目概览
yuenblue
/
PhpDemo
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PhpDemo
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
47def4a5
编写于
3月 23, 2024
作者:
Y
yuenblue
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
aaa
上级
38fc3965
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
44 addition
and
11 deletion
+44
-11
demotp6/app/controller/Demo.php
demotp6/app/controller/Demo.php
+8
-2
demotp6/app/controller/Index.php
demotp6/app/controller/Index.php
+3
-2
demotp6/config/route.php
demotp6/config/route.php
+3
-3
demotp6/route/app.php
demotp6/route/app.php
+6
-1
demotp6/tests/DemoTest.php
demotp6/tests/DemoTest.php
+13
-3
demotp6/tests/DemoTp6.php
demotp6/tests/DemoTp6.php
+4
-0
demotp6/tests/demo.php
demotp6/tests/demo.php
+7
-0
未找到文件。
demotp6/app/controller/Demo.php
浏览文件 @
47def4a5
<?php
namespace
app\controller
;
use
think\Request
;
class
Demo
{
function
Say
()
{
print
(
"你好,我是Demo"
);
function
phpinfo
()
{
phpinfo
();
}
function
say
(
Request
$request
)
{
return
"hello world!
{
$request
->
domain
()
}
"
;
}
}
\ No newline at end of file
demotp6/app/controller/Index.php
浏览文件 @
47def4a5
...
...
@@ -2,6 +2,7 @@
namespace
app\controller
;
use
app\BaseController
;
use
think\facade\Route
;
class
Index
extends
BaseController
{
...
...
@@ -12,7 +13,7 @@ class Index extends BaseController
public
function
hello
(
$name
=
'ThinkPHP6'
)
{
phpinfo
();
var_dump
(
$this
->
request
);
return
Route
::
buildUrl
(
'aaaa'
,[
'name'
=>
$name
])
->
__toString
();
}
}
demotp6/config/route.php
浏览文件 @
47def4a5
...
...
@@ -7,17 +7,17 @@ return [
// pathinfo分隔符
'pathinfo_depr'
=>
'/'
,
// URL伪静态后缀
'url_html_suffix'
=>
'
html
'
,
'url_html_suffix'
=>
''
,
// URL普通方式参数 用于自动生成
'url_common_param'
=>
true
,
// 是否开启路由延迟解析
'url_lazy_route'
=>
false
,
// 是否强制使用路由
'url_route_must'
=>
fals
e
,
'url_route_must'
=>
tru
e
,
// 合并路由规则
'route_rule_merge'
=>
false
,
// 路由是否完全匹配
'route_complete_match'
=>
fals
e
,
'route_complete_match'
=>
tru
e
,
// 访问控制器层名称
'controller_layer'
=>
'controller'
,
// 空控制器名
...
...
demotp6/route/app.php
浏览文件 @
47def4a5
...
...
@@ -10,8 +10,13 @@
// +----------------------------------------------------------------------
use
think\facade\Route
;
Route
::
group
(
"demo"
,
function
(){
Route
::
get
(
'say'
,
'demo/say'
);
Route
::
get
(
'i'
,
'demo/phpinfo'
);
});
Route
::
get
(
'think'
,
function
()
{
return
'hello,ThinkPHP6!'
;
});
Route
::
get
(
'hello/:name'
,
'index/hello'
);
Route
::
get
(
'hello/:name'
,
'index/hello'
)
->
name
(
"aaaa"
)
;
demotp6/tests/DemoTest.php
浏览文件 @
47def4a5
...
...
@@ -3,13 +3,23 @@ use PHPUnit\Framework\TestCase;
use
function
PHPUnit\Framework\assertEmpty
;
use
function
PHPUnit\Framework\assertNull
;
use
function
PHPUnit\Framework\assertTrue
;
use
app\controller\Demo
;
class
DemoTest
extends
TestCase
{
public
function
testAaa
(){
$dd
=
new
Demo
();
$dd
->
Say
();
assertEmpty
(
""
);
//
$dd=new Demo();
//
$dd->Say();
//
assertEmpty("");
}
function
tearDown
():
void
{
assertTrue
(
true
);
}
public
function
testLog
(){
echo
"aaaa"
;
echo
"bbbb"
;
}
}
demotp6/tests/DemoTp6.php
浏览文件 @
47def4a5
...
...
@@ -3,6 +3,7 @@ namespace think;
use
app\model\User
;
use
PHPUnit\Framework\TestCase
;
use
think\facade\Cache
;
use
think\facade\Config
;
use
think\facade\Db
;
...
...
@@ -52,4 +53,7 @@ class DemoTp6 extends TestCase{
// assertTrue($aa);
$this
->
assertNotEmpty
(
$user
);
}
function
testCache
()
{
Cache
::
get
(
""
)
}
}
\ No newline at end of file
demotp6/tests/demo.php
0 → 100644
浏览文件 @
47def4a5
<?php
echo
"aaaa
\r\n
"
;
echo
"aaaa
\r\n
"
;
echo
"aaaa
\r\n
"
;
print
"aaaa
\r\n
"
;
print
"aaaa
\r\n
"
;
print
"bbbb"
;
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录