123456789101112131415161718192021222324252627282930313233 |
- <?php
- session_start();
- require_once "config.inc.php";
- if (IN_DEBUG && is_file(".debug/debug.php")) {
- include_once ".debug/debug.php";
- }
- require_once IN_ROOT . "vendor/autoload.php";
- use think\facade\Db;
- Db::setConfig(["default" => "mysql", "connections" => ["mysql" => ["type" => "mysql", "hostname" => IN_DBHOST, "username" => IN_DBUSER, "password" => IN_DBPW, "database" => IN_DBNAME, "charset" => IN_DBCHARSET, "prefix" => IN_DBTABLE, "debug" => true]]]);
- $myConfig = IN_ROOT . "source/system/my.php";
- if (!is_file($myConfig)) {
- $res = db("config")->select();
- $conf = ["<?php"];
- foreach ($res as $k => $v) {
- if (!defined($v["name"])) {
- $conf[] = "define('" . $v["name"] . "','" . $v["value"] . "');";
- }
- }
- file_put_contents($myConfig, implode("\n", $conf));
- }
- require_once $myConfig;
- require_once IN_ROOT . "source/system/function_common.php";
- list($info, $module, $action) = path_info();
- function db($_var_0 = '')
- {
- return Db::name($_var_0);
- }
- function model($_var_1 = '')
- {
- return ("\\app\\model\\" . $_var_1)::name($_var_1);
- }
|