如何仿写thinkphp的C方法?

config.php代码如下:

<?php
return array(
             'db_user'=>'root',
             'db_pass'=>'root',
             'db_name'=>'test',
             'db_charset'=>'utf8',
             );
?>

C_function.php代码如下:

<?php
$username=C("db_user");
var_dump($username);
function C($key)
{
   $list=include 'config.php';
   return empty($list[$key])?null:$list[$key];
}
?>

 

相关文章:

  • 2022-12-23
  • 2022-01-12
  • 2021-05-16
  • 2021-11-08
  • 2022-01-03
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-01
  • 2022-12-23
相关资源
相似解决方案