转载请注明出处: http://blog.csdn/iwanghang/admin管理员组文章数量:1608627
觉得博文有用,请点赞,请评论,请关注,谢谢!~
在前2篇命名空间的博文基础上,我们来看一下,命名空间、公共空间 与 ThinkPHP5..0之间的关系:
1、controller控制器
首先我们找到index的控制器(controller),
\application\index\controller\Index.php,
修一下,修改后的Index.php:
<?php
namespace app\index\controller;
use think\Controller;
class Index extends Controller
{
public function index(){
return $this->fetch();
}
}
2、view视图
然后我们手动创建下面2个文件夹view和index,并创建用于控制index视图的index.html,\application\index\view\index\index.html,
创建好的index.html:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>iwanghang
</head>
<body>
</body>
</html>
还记得我们的入口文件吗?
\public\index.php,没有做任何修改,我们运行一下,打印结果是iwanghang
<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006-2016 http://thinkphp All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail>
// +----------------------------------------------------------------------
// [ 应用入口文件 ]
// 定义应用目录
define('APP_PATH', __DIR__ . '/../application/');
// 加载框架引导文件
require __DIR__ . '/../thinkphp/start.php';
更多的内容,我暂时也说不出来,让我们一起学习TP5,红尘作伴,活得潇潇洒洒~~以上学习的内容来自童攀老师的视频教程~
转载请注明出处: http://blog.csdn/iwanghang/
欢迎移动开发爱好者交流
沈阳或周边城市公司有意开发Android,请与我联系
联系方式
微信:iwanghang
QQ:413711276
邮箱:iwanghang@qq
觉得博文有用,请点赞,请评论,请关注,谢谢!~
版权声明:本文标题:Android程序员学PHP开发(33)-ThinkPHP5.0(5)命名空间与TP5-PhpStorm 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://m.elefans.com/xitong/1728552317a1163489.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论