我每次写控制器时候,总是加载它才能运行(MEDOO数据类)
写法是
<br> class ListController{
function index() {
require('Config/Conn.php');
$db=$data->select("mini_content",[
"id",
"title" ,
"content"
]
}
}
我把它放外面不起作用了
require('Config/Conn.php');
class ListController{
function index() {
$db=$data->select("mini_content",[
"id",
"title" ,
"content"
]
}
}
将来以后还要写控制器,一个一个写require('Config/Conn.php'); 很麻烦
例子:
<br> function index() {
require('Config/Conn.php');
}
function xxx() {
require('Config/Conn.php');
}
function xxx2() {
require('Config/Conn.php');
}
有什么办法 自定函数自动认require('Config/Conn.php'); 呢?
Difeye是一款超轻量级PHP框架,主要特点有: Difeye是一款超轻量级PHP框架,主要特点有: ◆数据库连接做自动主从读写分离配置,适合单机和分布式站点部署; ◆支持Smarty模板机制,可灵活配置第三方缓存组件; ◆完全分离页面和动作,仿C#页面加载自动执行Page_Load入口函数; ◆支持mysql,mongodb等第三方数据库模块,支持读写分离,分布式部署; ◆增加后台管理开发示例
0
我每次写控制器时候,总是加载它才能运行(MEDOO数据类)
写法是
<br> class ListController{
function index() {
require('Config/Conn.php');
$db=$data->select("mini_content",[
"id",
"title" ,
"content"
]
}
}
我把它放外面不起作用了
require('Config/Conn.php');
class ListController{
function index() {
$db=$data->select("mini_content",[
"id",
"title" ,
"content"
]
}
}
将来以后还要写控制器,一个一个写require('Config/Conn.php'); 很麻烦
例子:
<br> function index() {
require('Config/Conn.php');
}
function xxx() {
require('Config/Conn.php');
}
function xxx2() {
require('Config/Conn.php');
}
有什么办法 自定函数自动认require('Config/Conn.php'); 呢?
google composer
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号