PHP8.1.21版本已发布
vue8.1.21版本已发布
jquery8.1.21版本已发布

博客列表 > 企业站点开发之后台

企业站点开发之后台

沈斌的博客
沈斌的博客 原创
2018年06月14日 20:39:34 873浏览

企业站点开发后台页面使用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://m.sbmmt.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 核实处理。
全部评论
文明上网理性发言,请遵守新闻评论服务协议