Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
yuenblue
PhpDemo
提交
d15aea76
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 搜索 >>
提交
d15aea76
编写于
3月 23, 2024
作者:
Y
yuenblue
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'master' of gitcode.net:yuencczzy/phpdemo
上级
47def4a5
c25c96e9
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
158 addition
and
16 deletion
+158
-16
demotp6/.env.example
demotp6/.env.example
+1
-1
demotp6/app/controller/User.php
demotp6/app/controller/User.php
+24
-0
demotp6/app/view/user/login.html
demotp6/app/view/user/login.html
+11
-0
demotp6/composer.json
demotp6/composer.json
+2
-1
demotp6/composer.lock
demotp6/composer.lock
+83
-1
demotp6/config/database.php
demotp6/config/database.php
+6
-6
demotp6/public/index.php
demotp6/public/index.php
+1
-1
demotp6/route/app.php
demotp6/route/app.php
+6
-0
demotp6/tests/DemoTp6.php
demotp6/tests/DemoTp6.php
+24
-6
未找到文件。
demotp6/.env.example
浏览文件 @
d15aea76
...
...
@@ -5,7 +5,7 @@ DEFAULT_TIMEZONE = Asia/Shanghai
[DATABASE]
TYPE = mysql
HOSTNAME =
127.0.0.1
HOSTNAME =
localhost
DATABASE = demotp6
USERNAME = root
PASSWORD = root
...
...
demotp6/app/controller/User.php
0 → 100644
浏览文件 @
d15aea76
<?php
namespace
app\controller
;
use
app\BaseController
;
use
think\facade\View
;
class
User
extends
BaseController
{
public
function
index
()
{
return
'<style type="text/css">*{ padding: 0; margin: 0; } div{ padding: 4px 48px;} a{color:#2E5CD5;cursor: pointer;text-decoration: none} a:hover{text-decoration:underline; } body{ background: #fff; font-family: "Century Gothic","Microsoft yahei"; color: #333;font-size:18px;} h1{ font-size: 100px; font-weight: normal; margin-bottom: 12px; } p{ line-height: 1.6em; font-size: 42px }</style><div style="padding: 24px 48px;"> <h1>:) </h1><p> ThinkPHP V'
.
\
think\facade\App
::
version
()
.
'<br/><span style="font-size:30px;">16载初心不改 - 你值得信赖的PHP框架</span></p><span style="font-size:25px;">[ V6.0 版本由 <a href="https://www.yisu.com/" target="yisu">亿速云</a> 独家赞助发布 ]</span></div><script type="text/javascript" src="https://e.topthink.com/Public/static/client.js"></script><think id="ee9b1aa918103c4fc"></think>'
;
}
public
function
hello
(
$name
=
'ThinkPHP6'
)
{
return
'hello,'
.
$name
;
}
function
login
()
{
// return View::engine("php")->fetch('user/login');
// return View::fetch('user/login');
return
$this
->
app
->
view
->
fetch
();
}
}
demotp6/app/view/user/login.html
0 → 100644
浏览文件 @
d15aea76
<!DOCTYPE html>
<html
lang=
"en"
>
<head>
<meta
charset=
"UTF-8"
>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1.0"
>
<title>
Document
</title>
</head>
<body>
<h1>
登录页面~!
</h1>
</body>
</html>
\ No newline at end of file
demotp6/composer.json
浏览文件 @
d15aea76
...
...
@@ -23,7 +23,8 @@
"php"
:
">=7.2.5"
,
"topthink/framework"
:
"^6.1.0"
,
"topthink/think-orm"
:
"^2.0"
,
"topthink/think-filesystem"
:
"^1.0"
"topthink/think-filesystem"
:
"^1.0"
,
"topthink/think-view"
:
"^2.0"
},
"require-dev"
:
{
"symfony/var-dumper"
:
"^4.2"
,
...
...
demotp6/composer.lock
浏览文件 @
d15aea76
...
...
@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "
7571874c932d1e243ba0fd635cc0bfc7
",
"content-hash": "
c6839ac29846e44be67cec1ba557e486
",
"packages": [
{
"name": "league/flysystem",
...
...
@@ -671,6 +671,88 @@
"source": "https://github.com/top-think/think-orm/tree/v2.0.61"
},
"time": "2023-04-20T14:27:51+00:00"
},
{
"name": "topthink/think-template",
"version": "v3.0.0",
"source": {
"type": "git",
"url": "https://github.com/top-think/think-template.git",
"reference": "4352d2cf627abfb8b49f830686c25c02f59c23f2"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/top-think/think-template/zipball/4352d2cf627abfb8b49f830686c25c02f59c23f2",
"reference": "4352d2cf627abfb8b49f830686c25c02f59c23f2",
"shasum": ""
},
"require": {
"php": ">=8.0.0",
"psr/simple-cache": ">=1.0"
},
"type": "library",
"autoload": {
"psr-4": {
"think\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"Apache-2.0"
],
"authors": [
{
"name": "liu21st",
"email": "liu21st@gmail.com"
}
],
"description": "the php template engine",
"support": {
"issues": "https://github.com/top-think/think-template/issues",
"source": "https://github.com/top-think/think-template/tree/v3.0.0"
},
"time": "2023-02-25T12:11:14+00:00"
},
{
"name": "topthink/think-view",
"version": "v2.0.0",
"source": {
"type": "git",
"url": "https://github.com/top-think/think-view.git",
"reference": "d2a076011c96d2edd8016703a827fb54b2683c62"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/top-think/think-view/zipball/d2a076011c96d2edd8016703a827fb54b2683c62",
"reference": "d2a076011c96d2edd8016703a827fb54b2683c62",
"shasum": ""
},
"require": {
"php": ">=8.0.0",
"topthink/think-template": "^3.0"
},
"type": "library",
"autoload": {
"psr-4": {
"think\\view\\driver\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"Apache-2.0"
],
"authors": [
{
"name": "liu21st",
"email": "liu21st@gmail.com"
}
],
"description": "thinkphp template driver",
"support": {
"issues": "https://github.com/top-think/think-view/issues",
"source": "https://github.com/top-think/think-view/tree/v2.0.0"
},
"time": "2023-02-25T12:18:09+00:00"
}
],
"packages-dev": [
...
...
demotp6/config/database.php
浏览文件 @
d15aea76
...
...
@@ -22,17 +22,17 @@ return [
'connections'
=>
[
'mysql'
=>
[
// 数据库类型
'type'
=>
env
(
'database.type'
,
'mysql'
),
'type'
=>
env
(
'database.type'
),
// 服务器地址
'hostname'
=>
env
(
'database.hostname'
,
'127.0.0.1'
),
'hostname'
=>
env
(
'database.hostname'
),
// 数据库名
'database'
=>
env
(
'database.database'
,
'demotp6'
),
'database'
=>
env
(
'database.database'
),
// 用户名
'username'
=>
env
(
'database.username'
,
'root'
),
'username'
=>
env
(
'database.username'
),
// 密码
'password'
=>
env
(
'database.password'
,
''
),
'password'
=>
env
(
'database.password'
),
// 端口
'hostport'
=>
env
(
'database.hostport'
,
'3306'
),
'hostport'
=>
env
(
'database.hostport'
),
// 数据库连接参数
'params'
=>
[],
// 数据库编码默认采用utf8
...
...
demotp6/public/index.php
浏览文件 @
d15aea76
...
...
@@ -15,7 +15,7 @@ namespace think;
require
__DIR__
.
'/../vendor/autoload.php'
;
// 执行HTTP应用并响应
$http
=
(
new
App
())
->
http
;
$http
=
(
new
App
())
->
setEnvName
(
'example'
)
->
http
;
$response
=
$http
->
run
();
...
...
demotp6/route/app.php
浏览文件 @
d15aea76
...
...
@@ -10,6 +10,12 @@
// +----------------------------------------------------------------------
use
think\facade\Route
;
Route
::
group
(
'user'
,
function
(){
Route
::
get
(
'/'
,
'user/index'
);
Route
::
get
(
'index'
,
'user/index'
);
Route
::
get
(
'login'
,
'user/login'
);
});
Route
::
group
(
"demo"
,
function
(){
Route
::
get
(
'say'
,
'demo/say'
);
...
...
demotp6/tests/DemoTp6.php
浏览文件 @
d15aea76
...
...
@@ -43,15 +43,33 @@ class DemoTp6 extends TestCase{
// assertTrue(true);
// table方法必须指定完整的数据表名
// $aa=Db::table('tp6_user')->where('id', 1)->find();
$app
=
App
();
$aa
=
$app
->
db
->
table
(
'tp6_user'
)
->
find
(
2
);
var_dump
(
$aa
);
// $aa=Db::table('tp6_user')->find(2);
// var_dump($aa);
$app
=
app
();
$user
=
User
::
find
(
1
);
$user
->
username
=
'bbbb'
;
$user
->
save
();
// $app = app();
// $user = new User();
// $user->username='cccc';
// $user->password='dddd';
// $user->save();
// $user = User::find(2);
// $user->username='eeee';
// $user->save();
// assertTrue($aa);
$this
->
assertNotEmpty
(
$user
);
$this
->
assertNotEmpty
(
true
);
}
function
testCache
()
{
Cache
::
get
(
""
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录