Blogger Information
Blog 56
fans 3
comment 1
visits 50666
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
企业站点开发之后台
沈斌的博客
Original
958 people have browsed it

企业站点开发后台页面使用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

Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post