博主信息
博文 56
粉丝 3
评论 1
访问量 60879
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
企业站点开发之后台
沈斌的博客
原创
1189人浏览过

企业站点开发后台页面使用X-admin,配置admin.php 作为入口文件,可以直接访问。

application\admin\controller\Index.php


实例

<?php
namespace app\admin\controller;
use app\common\controller\Base;

class Index extends Base
{
    public function index(){

        return $this->view->fetch();

    }

    public function welcome(){
    	return $this->view->fetch();
    }
}

运行实例 »

点击 "运行实例" 按钮查看在线实例

application\admin\view\index\welcome.html


实例

<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <title>欢迎页面-X-admin2.0</title>
        <meta name="renderer" content="webkit">
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
        <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
        <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
        <link rel="stylesheet" href="__ADMIN__/css/font.css">
        <link rel="stylesheet" href="__ADMIN__/css/xadmin.css">
    </head>
    <body>
    <div class="x-body layui-anim layui-anim-up">
        <blockquote class="layui-elem-quote">欢迎管理员:
            <span class="x-red"></span>!当前时间:2018-04-25 20:50:53</blockquote>
        
      
       
        <fieldset class="layui-elem-field">
            <legend>系统信息</legend>
            <div class="layui-field-box">
                <table class="layui-table">
                    <tbody>
                        <tr>
                            <th>ThinkPHP版本</th>
                            <td>{$Think.VERSION}</td></tr>
                        <tr>
                            <th>操作系统</th>
                            <td>{$Think.const.PHP_OS}</td></tr>
                        <tr>
                            <th>服务器地址</th>
                            <td>{$Think.server.server_addr}</td></tr>
                        <tr>
                            <th>运行环境</th>
                            <td>{$Think.server.http_user_agent}</td></tr>
                        <tr>
                            <th>PHP版本</th>
                            <td>{$Think.const.PHP_VERSION}</td></tr>
                        <tr>
                            <th>PHP运行方式</th>
                            <td>cgi-fcgi</td></tr>
                        <tr>
                            <th>MYSQL版本</th>
                            <td>{:getMysqlVersion()}</td></tr>
                        <tr>
                            <th>ThinkPHP</th>
                            <td>{$Think.VERSION}</td></tr>
                        <tr>
                            <th>上传附件限制</th>
                            <td>{:\ini_get('post_max_size')}</td></tr>
                        <tr>
                            <th>执行时间限制</th>
                            <td>{:\ini_get('max_execution_time')}</td></tr>
                        <tr>
                            <th>剩余空间</th>
                            <td>{:\round(disk_free_space("/")/1024/1024/1024,2)}G</td></tr>
                    </tbody>
                </table>
            </div>
        </fieldset>
        
       
    </div>
        <script>
        var _hmt = _hmt || [];
        (function() {
          var hm = document.createElement("script");
          hm.src = "https://hm.baidu.com/hm.js?b393d153aeb26b46e9431fabaf0f6190";
          var s = document.getElementsByTagName("script")[0]; 
          s.parentNode.insertBefore(hm, s);
        })();
        </script>
    </body>
</html>

运行实例 »

点击 "运行实例" 按钮查看在线实例

application\common\controller\Base.php

实例

<?php
namespace app\common\controller;
use think\Controller;


class Base extends Controller
{
     protected function initialize()
     {
	     parent::initialize();

		 $this->filter(function($content){
			 return str_replace('__ADMIN__','/static/admin',$content);
		 });
    
    
     }
}

运行实例 »

点击 "运行实例" 按钮查看在线实例

application\common.php

实例

<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006-2016 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: 流年 <liu21st@gmail.com>
// +----------------------------------------------------------------------

// 应用公共文件
use think\Db;
function getUserName(){
	return Db::connect('qiye')->table('user')->value('user_name');
}

function getCurrentTime(){
	return date('Y-m-d H:i:s',time());
}

function getMysqlVersion(){
	return Db::connect('qiye')->query('SELECT VERSION() AS version')[0]['version'];
}

运行实例 »

点击 "运行实例" 按钮查看在线实例

comp.png

本博文版权归博主所有,转载请注明地址!如有侵权、违法,请联系admin@php.cn举报处理!
全部评论 文明上网理性发言,请遵守新闻评论服务协议
0条评论
作者最新博文
关于我们 免责申明 意见反馈 讲师合作 广告合作 最新更新 English
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习
PHP中文网抖音号
发现有趣的

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号

  • 登录PHP中文网,和优秀的人一起学习!
    全站2000+教程免费学