时间:2021-07-01 10:21:17 帮助过:47人阅读
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'); 很麻烦
例子:
function index() {
require('Config/Conn.php');
}
function xxx() {
require('Config/Conn.php');
}
function xxx2() {
require('Config/Conn.php');
}
有什么办法 自定函数自动认require('Config/Conn.php'); 呢?
我每次写控制器时候,总是加载它才能运行(MEDOO数据类)
写法是
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'); 很麻烦
例子:
function index() {
require('Config/Conn.php');
}
function xxx() {
require('Config/Conn.php');
}
function xxx2() {
require('Config/Conn.php');
}
有什么办法 自定函数自动认require('Config/Conn.php'); 呢?
google composer