首页
直播
壁纸
免责声明
更多
统计
关于
Search
1
一款自动化渗透工具包 TscanPlus
225 阅读
2
获取一张美国虚拟信用卡
223 阅读
3
JS Document.evaluate()的使用
199 阅读
4
Git冲突:Please commit your changes or stash them before you merge
174 阅读
5
Python 31条 pip 命令全解析
164 阅读
默认分类
操作系统
Linux
管理面板
实用工具
开发语言
PHP
Web
python
typecho
ThinkPHP
layui
爬虫
文章分享
登录
Search
标签搜索
python
php
web
linux
Git
js
requests
自动化
宝塔
thinkphp
Centos
adb
html
typecho
layui
jquery
ubuntu
multipass
虚拟机
thikphp
YiYun
累计撰写
54
篇文章
累计收到
21
条评论
首页
栏目
默认分类
操作系统
Linux
管理面板
实用工具
开发语言
PHP
Web
python
typecho
ThinkPHP
layui
爬虫
文章分享
页面
直播
壁纸
免责声明
统计
关于
搜索到
8
篇与
的结果
2024-03-28
用tp6新建项目 -- 转载
用thinkphp6初始化一个项目composer安装tp6框架composer create-project topthink/think tp6tp6这个名字可以随意改动 添加多应用模式composer require topthink/think-multi-app添加视图,模板引擎composer require topthink/think-viewwin下phpstudy隐藏index.php文件,要在htaccess文件里/index.ph前面加个?添加权限类composer require zhenhaihou/think-auth原文出处:用tp6新建项目
2024年03月28日
130 阅读
0 评论
0 点赞
2024-03-27
thinkphp 命令行的使用--转载
1.前言ThinkPHP 支持 Console 应用,通过命令行的方式执行一些 URL 访问不方便或者安全性较高的操作。前面学习的接口封装,都是基于 HTTP 请求的,请求时间是会有超时时间的,若使用命令行可以在后台进程运行,而不是依赖于访问进程,ThinkPHP 命令行提供了一些方便的工具 ,下面介绍如何使用 ThinkPHP 命令行。2.通过命令行查看版本在框架的根目录下,有一个 think 脚本文件,可以使用 php 进程去调用它,查看 ThinkPHP 框架版本可以使用如下命令:php think version3.快速生成控制器若想要单应用 app\controller 目录下快速生成控制器和方法,可以使用如下命令:php think make:controller test生成的控制器文件内容如下:<?php declare (strict_types = 1); namespace app\controller; use think\Request; class test { /** * 显示资源列表 * * @return \think\Response */ public function index() { // } /** * 显示创建资源表单页. * * @return \think\Response */ public function create() { // } /** * 保存新建的资源 * * @param \think\Request $request * @return \think\Response */ public function save(Request $request) { // } /** * 显示指定的资源 * * @param int $id * @return \think\Response */ public function read($id) { // } /** * 显示编辑资源表单页. * * @param int $id * @return \think\Response */ public function edit($id) { // } /** * 保存更新的资源 * * @param \think\Request $request * @param int $id * @return \think\Response */ public function update(Request $request, $id) { // } /** * 删除指定资源 * * @param int $id * @return \think\Response */ public function delete($id) { // } } {callout color="#002aff"}Tips: 其中快速生成几种常见的方法名,如果只想生成控制器可以使用 php think make:controller test --plain。{/callout}4.快速生成模型若想要单应用 app\model 目录下快速生成模型,可以使用如下命令:php think make:model TestModel生成的模型文件内容如下:<?php declare (strict_types = 1); namespace app\model; use think\Model; /** * @mixin \think\Model */ class TestModel extends Model { // }{callout color="#004cff"}Tips: declare (strict_types = 1)表示开启严格模式。{/callout}5.快速生成中间件若想要单应用 app\middleware 目录下快速生成模型,可以使用如下命令:php think make:middleware Auth生成的中间件文件内容如下:<?php declare (strict_types = 1); namespace app\middleware; class Auth { /** * 处理请求 * * @param \think\Request $request * @param \Closure $next * @return Response */ public function handle($request, \Closure $next) { // } }6.快速生成验证器若想要单应用 app\Models 目录下快速生成模型,可以使用如下命令:php think make:validate Test生成的验证器文件内容如下:<?php declare (strict_types = 1); namespace app\validate; use think\Validate; class Test extends Validate { /** * 定义验证规则 * 格式:'字段名' => ['规则1','规则2'...] * * @var array */ protected $rule = []; /** * 定义错误信息 * 格式:'字段名.规则名' => '错误信息' * * @var array */ protected $message = []; } 7.清除缓存文件若想要清除 runtime目录下的缓存文件,可以使用如下命令:php think clear清除之后如下图所示:{callout color="#004cff"}Tips: 若不需要保留空目录,可以使用 php think clear --dir。{/callout}8.输出路由定义列表若想要查看定义了哪些路由,可以使用如下命令:php think route:list9.小结本小节介绍了如何简单的使用 ThinkPHP 提供的命令行,使用这些命令行可以快速的生成控制器、模型、中间件、验证器,也可以根据实际情况选择手动创建这些文件,另外还介绍了如何使用命令行清空缓存,使用命令行查看框架中定义了哪些路由的列表。熟练地掌握这些命令行将会使你的开发效率更高。原文链接:https://www.imooc.com/wiki/thinkphplesson/thinkcommand.html
2024年03月27日
141 阅读
0 评论
0 点赞
2024-03-26
Typecho博客中常用的调用函数
一、站点相关站点名称:<?php $this->options->title(); ?>站点URL:<?php $this->options ->siteUrl(); ?>站点说明:<?php $this->options->description() ?>4.站点后台URL:<?php $this->options->adminUrl(); ?>站点RSS:<?php $this->options->feedUrl(); ?>站点首页判断:<?php if ($this->is('index')): ?>首页输出内容<?php else: ?>不是首页输出内容<?php endif; ?>整站数据统计输出:<;?php Typecho_Widget::widget('Widget_Stat')->to($stat); ?>文章总数:<;?php $stat->publishedPostsNum() ?> 篇分类总数:<?php $stat->categoriesNum() ?>个评论总数:<?php $stat->publishedCommentsNum() ?>条页面总数:<?php $stat->publishedPagesNum() ?>个当前作者的文章总数:<?php $stat->myPublishedPostsNum() ?>篇二、文章相关文章或页面的标题:<?php $this->title() ?>文章或页面的URL:<?php $this->permalink() ?>文章或页面的发表时间:<?php $this->date(); ?>文章或页面的访问次数:<?php Views_Plugin::theViews('被访问 ', '次'); ?>文章上一篇:<?php $this->theNext(); ?>文章下一篇:<?php $this->thePrev(); ?>文章分类名:<?php $categorys->name();?>截取文章摘要,200字数限制:<?php $this->excerpt(200, '.. .'); ?>作者:<?php $this->author(); ?>作者的邮箱地址:<?php $this->author->mail(); ?>文章作者URL:<?php $this->author->url(); ?>作者全部文章列表URL:<?php $this->author->permalink(); ?>最后更新:<?php echo date(_mt("Y 年 m 月 d 日 h : i A") , $this->modified + $this->options->timezone - idate("Z"));?>三、参数说明获取已发布的文章数目:publishedPostsNum获取待审核的文章数目:waitingPostsNum获取草稿文章数目:draftPostsNum获取当前用户已发布的文章数目:myPublishedPostsNum获取当前用户待审核文章数目:myWaitingPostsNum获取当前用户草稿文章数目:myDraftPostsNum获取当前用户已发布的文章数目:currentPublishedPostsNum获取当前用户待审核文章数目:currentWaitingPostsNum获取当前用户草稿文章数目:currentDraftPostsNum获取已发布页面数目:publishedPagesNum获取草稿页面数目:draftPagesNum获取当前显示的评论数目:publishedCommentsNum获取当前待审核的评论数目:waitingCommentsNum获取当前垃圾评论数目:spamCommentsNum获取当前用户显示的评论数目:myPublishedCommentsNum获取当前用户显示的评论数目:myWaitingCommentsNum获取当前用户显示的评论数目:mySpamCommentsNum获取当前文章的评论数目:currentCommentsNum获取当前文章显示的评论数目:currentPublishedCommentsNum获取当前文章显示的评论数目:currentWaitingCommentsNum获取当前文章显示的评论数目:currentSpamCommentsNum获取分类数目:categoriesNum四、其他页面标题 - 站点名称:<?php $this->archiveTitle('','',' - '); ?><?php $this->options->title(); ?>主题模板URL:<?php $this->options->themeUrl(); ?>PHP引用:<?php $this->need('*.php'); ?> 可以使用相对路径获取上级目录php文件调用自定义字段:<?php $this->fields->fieldName ?>当前登录用户:<?php $this->user->screenName(); ?>退出:<a href="<?php $this->options->logoutUrl(); ?>"> <?php _e('退出'); ?> </a>完整路径标题:<?php $this->archiveTitle(' » ', < span class="string">'', ' | '); ?><?php $this ->options->title(); ?>
2024年03月26日
158 阅读
4 评论
0 点赞
1
2