我想在 index.php
(Fat Free Framework)中包含两个文件(routes.php
和 globals.php
),但是我不知道怎么办。
我尝试过要求并包含无脂肪方式:
$f3=require('lib/base.php');
$f3=require('app/globals.php');
$f3=require('app/routes.php');
$f3=include('app/globals.php');
$f3=include('app/routes.php');
然后就是普通的 PHP:
require 'app/globals.php';
require 'app/routes.php';
但是它不起作用。
这有效:
$f3->config('app/globals.cfg');
$f3->config('app/routes.cfg');
但我不想使用 .cfg
文件,只想使用 .php
。
最佳答案
如果您害怕向客户端浏览器提供 .cfg 或 .ini 文件,您可以简单地在附带的 .htaccess 文件中禁止这样做。
RewriteCond %{REQUEST_URI} \.cfg
RewriteRule \.cfg$ - [R=404]
关于php - 在index.php(Fat-Free Framework)中包含文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20814139/