<?php
/*static()静态属性:
*/
//静态属性:
/*class Model{
private $mysqli;
static $config;//数据库连接状态
function __construct()
{
echo "<pre>";
$this->getConfig();
$this->connect();
}
private function connect(){
$this->mysqli=Model::$config['webconfig']['weburl'];
echo $this->mysqli;
}
private function getConfig(){
if (empty(self::$config)){
self::$config=require 'db_config.php';
print_r(self::$config);
}
}
}
$channel=new Model();
$channel=new Model();
$channel=new Model();*/
//静态方法:
/*class a{
public function bb(){
$this->aa();
}
static public function aa(){
//静态方法里面只能放,类的属性和方法(self:: parent) 。不能放对象的($this)
echo "aa";
}
}
$b=new a();
$b->bb();*/
//初始化网站文件数据
class App{
static function _config(){
date_default_timezone_get('PRC');//设置默认时区
setlocale(LC_TIME,'chs');//设置地区信息 LC_TIME 时间与格式 strftime()
}
static function _loadfiel(){
echo "载入文件";
}
static function run(){
self::_config();
self::_loadfiel();
}
}
App::run();