当前位置: 首页 > news >正文

广州做网站一般多少钱wordpress 3.9.2

广州做网站一般多少钱,wordpress 3.9.2,网站页面打开速度,网页游戏下载上一篇文章写怎么单独使用illuminate/database#xff0c;这回讲下怎么整合到项目里使用。为此特意看了下laravel对其使用。本篇文章#xff0c;参照laravel的使用#xff0c;简单实现。 一 原理 laravel 里使用illuminate/config。 illuminate/config composer 地址…上一篇文章写怎么单独使用illuminate/database这回讲下怎么整合到项目里使用。为此特意看了下laravel对其使用。本篇文章参照laravel的使用简单实现。 一 原理 laravel 里使用illuminate/config。 illuminate/config composer 地址illuminate/config - Packagist illuminate/config github 地址:GitHub - illuminate/config: [READ ONLY] Subtree split of the Illuminate Config component (see laravel/framework) 根据  illuminate/config 源码显示 illuminate/config/Repository.php  仅继承Illuminate\Contracts\Config\Repository没有其他操作。 所以编写Myconfig.php相同代码没有加入 illuminate/config。也可以直接执行命令添加。 composer require illuminate/config:版本 通过查看laravel源码发现先加入容器再重写容器中绑定的对象。 之所以不能直接绑定操作后的对象因为bind()、bindIf()等相关方法中被绑定的数据不能传对象而instance()没有此限制所以能传设置参数后的对象。 数据库管理对象构造传入容器对象会自动获取config对应参数。之后可以直接查询。 例子里对于设置容器后处理配置文件的流程与laravel不同。laravel中更复杂也更完善。 二 代码 目录结构 - test.php - config/database.php - Myconfig.php //test.php require_once ./vendor/autoload.php; require_once ./Myconfig.php;use Illuminate\Container\Container; use Illuminate\Database\Capsule\Manager as DbManager; use Illuminate\Events\Dispatcher;class Loader {private $container;public function __construct(Container $container){$this-container $container;$this-makes();}private function get_makes_list(){$list [config Myconfig::class,];return $list;}private function makes(){$list $this-get_makes_list();foreach ($list as $key $value) {$this-container-bindIf($key, $value);}}public function get_path_list($name){$list [config ./config,];return $list[$name] ? $list[$name] : false;} }class App {private $container;private $loader;public function __construct(){$this-container new Container();$this-loader new Loader($this-container);$this-init();}public function init(){$this-init_config();$this-init_db();}private function init_config(){$config_list [];$config_path $this-loader-get_path_list(config);if ($files_list opendir($config_path)) {while (($file readdir($files_list)) ! false) {if (!preg_match(/(.*).php/, $file, $matches)) {continue;}$data include $config_path . / . $file;if (!is_array($data)) {continue;}$file_name $matches[1];foreach ($data as $key $value) {$list_key $file_name . . . $key;$config_list[$list_key] $value;}}}if (!empty($config_list)) {$myconfig new Myconfig($config_list);$this-container-instance(config, $myconfig);}}private function init_db(){$dbm new DbManager($this-container);$dbm-setEventDispatcher(new Dispatcher(new Container));$dbm-setAsGlobal(); //设置静态全局可用$dbm-bootEloquent();} }function test() {new App();$info DbManager::table(userinfo)-where(id, , 2)-get();var_dump($info); }test(); //./config/database.php return [migrations , //数据迁移//PDO文档 https://www.php.net/manual/zh/pdo.constants.phpfetch PDO::FETCH_OBJ,default master,connections [master [driver mysql,host localhost,database test,username root,password qwe110110,charset utf8,collation utf8_general_ci,prefix ,],test [driver mysql,host 127.0.0.1,database brook3_master,username root,password root,charset utf8mb4,collation utf8mb4_unicode_ci,prefix ,],], ];//./Myconfig.php use Illuminate\Contracts\Config\Repository as ConfigContract; use Illuminate\Support\Arr;class Myconfig implements ConfigContract, ArrayAccess {/*** All of the configuration items.** var array*/protected $items [];/*** Create a new configuration repository.** param array $items* return void*/public function __construct(array $items []){$this-items $items;}/*** Determine if the given configuration value exists.** param string $key* return bool*/public function has($key){return Arr::has($this-items, $key);}/*** Get the specified configuration value.** param array|string $key* param mixed $default* return mixed*/public function get($key, $default null){if (is_array($key)) {return $this-getMany($key);}return Arr::get($this-items, $key, $default);}/*** Get many configuration values.** param array $keys* return array*/public function getMany($keys){$config [];foreach ($keys as $key $default) {if (is_numeric($key)) {[$key, $default] [$default, null];}$config[$key] Arr::get($this-items, $key, $default);}return $config;}/*** Set a given configuration value.** param array|string $key* param mixed $value* return void*/public function set($key, $value null){$keys is_array($key) ? $key : [$key $value];foreach ($keys as $key $value) {Arr::set($this-items, $key, $value);}}/*** Prepend a value onto an array configuration value.** param string $key* param mixed $value* return void*/public function prepend($key, $value){$array $this-get($key, []);array_unshift($array, $value);$this-set($key, $array);}/*** Push a value onto an array configuration value.** param string $key* param mixed $value* return void*/public function push($key, $value){$array $this-get($key, []);$array[] $value;$this-set($key, $array);}/*** Get all of the configuration items for the application.** return array*/public function all(){return $this-items;}/*** Determine if the given configuration option exists.** param string $key* return bool*/#[\ReturnTypeWillChange]public function offsetExists($key){return $this-has($key);}/*** Get a configuration option.** param string $key* return mixed*/#[\ReturnTypeWillChange]public function offsetGet($key){return $this-get($key);}/*** Set a configuration option.** param string $key* param mixed $value* return void*/#[\ReturnTypeWillChange]public function offsetSet($key, $value){$this-set($key, $value);}/*** Unset a configuration option.** param string $key* return void*/#[\ReturnTypeWillChange]public function offsetUnset($key){$this-set($key, null);} }
http://wiki.neutronadmin.com/news/203060/

相关文章:

  • 东莞高端模板建站html网站的规划与建设6
  • 建立自己的网站平台须多少钱返利网站开发一般要多少钱
  • 网站制作代理修改wordpress文章发布页面模板
  • 城厢区建设局网站海南网站建设及维护
  • 百度云做网站有优势吗网站搭建技术有哪些
  • 自动搭建网站wordpress 安装权限管理
  • 做整合营销的网站深圳平价的专业建站公司
  • 网站域名建设费进什么科目响应式 网站 设计软件
  • 铜仁住房和城乡建设局网站大连企业信息查询系统官网
  • 网站建设在线视频电商网站 手续
  • 网站后台管理怎么做友情链接微信公众号推广的方法
  • 好看的免费网站模板下载dede做网站
  • 系部网站建设需求分析运行需求wpf做的网站
  • 网站推荐你了解我意思吧官网设计比较好看的网站
  • 做虚假网站犯法吗电子商务网站建设作业案例
  • 绵阳市住房和城乡建设局网站网站有什么功能
  • 网站建设山东聚搜网络c 还可以做网站
  • 宜兴营销型网站建设阿里云网站的网页怎么做
  • 长沙自助模板建站企业管理软件销售
  • 最先进的深圳网站建设山东坤泰建设集团网站
  • 行政单位网站建设立项依据乐华网络公司介绍
  • 24小时网站建设手机网站乱弹
  • 做t-shirt素材网站中企邮箱登录入口
  • 新建网站做优化建设公司起名
  • 江西赣建建设监理网站手机优化大师怎么退款
  • 建设个网站做彩票网站需要什么服务器
  • 交互型网站开发网站建设接单技巧
  • 自己编写网站四川成都新冠最新消息
  • 网站信息备案管理系统wordpress post slug codex
  • 珠海七中科技制作汕头seo网站管理