function test_action_login() { $auth = new Auth(); $_SESSION = array(); \PtConfig::$userRsaAuth = false; $auth_info = $auth->action_info(); $res = $auth->action_login("13555555555", "111111"); //var_export($res); $user_id = \Model_Admin_Auth::get_user_id(); var_export($user_id); }
<?php /** * Created by PhpStorm. * User: joseph * Date: 16/3/23 * Time: 上午12:21 */ if (PHP_SAPI != 'cli') { $save_handler = "Redis"; $save_path = "tcp://127.0.0.1:6379?auth="; if (($save_handler == "Redis" || $save_handler == "Memcached") && class_exists($save_handler)) { ini_set("session.save_handler", $save_handler); ini_set("session.save_path", $save_path); } //ini_set('session.name', "jid_001"); #30天过期 单位:秒 ini_set('session.gc_maxlifetime', 2592000); #过期后清除概率 gc_probability / gc_divisor : 1/1000 ini_set('session.gc_probability', 1); ini_set('session.gc_divisor', 1000); } PtPHP\Logger::init(array('level' => 'INFO', 'files' => array('ALL' => PATH_PRO . '/logs/' . date("Y-m-d") . '.log'))); PtConfig::$safeLogin['username'] = "******"; PtConfig::$safeLogin['password'] = "******"; PtConfig::$qiniu = array("access_key" => "zlbOjuyGIUaq73PhpZVetqvcPIPk6EgugFHY3N-y", "secret_key" => "7uiio8iIRfqOtlYqGpZpp7G3IpyUVOO5-QPkWkja", "bucket" => "lvdiantong", "domain" => "7xq9wj.com1.z0.glb.clouddn.com"); PtPHP\PtRedis::$config = array("default" => array("host" => "127.0.0.1", "port" => 6379, "auth" => "")); Model_Wechat_Api::$config['appid'] = ''; Model_Wechat_Api::$config['appsecret'] = ''; Model_Wechat_Api::$config_open['appid'] = ''; Model_Wechat_Api::$config_open['appsecret'] = '';
* */ class PtConfig { public static $env = "development"; public static $qiniu = array("access_key" => "zlbOjuyGIUaq73PhpZVetqvcPIPk6EgugFHY3N-y", "secret_key" => "7uiio8iIRfqOtlYqGpZpp7G3IpyUVOO5-QPkWkja", "bucket" => "lvdiantong", "domain" => "7xq9wj.com1.z0.glb.clouddn.com"); public static $userRsaAuth = true; public static $safeLogin = array("username" => "", "password" => ""); public static $siteAdminTitle = "PtPHP"; } $env = Utils::get_pt_env("APPLICATION_ENV"); if ($env) { PtConfig::$env = $env; } else { if (is_file(__DIR__ . "/.env.php")) { PtConfig::$env = (require_once __DIR__ . "/.env.php"); } } $phinx_config = null; if (is_file(PATH_PRO . "/phinx.yml")) { $phinx_config = Yaml::parse(@file_get_contents(PATH_PRO . "/phinx.yml")); } elseif (is_file(PATH_APP . "/config/phinx.yml")) { $phinx_config = Yaml::parse(@file_get_contents(PATH_APP . "/config/phinx.yml")); } if ($phinx_config) { $db_config = $phinx_config['environments'][PtConfig::$env]; PtPHP\Database::$config = array('default' => array('type' => 'mysql', 'host' => $db_config['host'], 'port' => $db_config['port'], 'dbname' => $db_config['name'], 'dbuser' => $db_config['user'], 'dbpass' => $db_config['pass'], 'charset' => $db_config['charset'], 'prefix' => $db_config['table_prefix'])); } $env_setting_path = __DIR__ . "/env/" . PtConfig::$env . ".php"; if (is_file($env_setting_path)) { require_once $env_setting_path;