[英]Blank pages using the SLIM PHP framework
I am currently developing a web application using the latest Slim version. 我目前正在使用最新的Slim版本开发Web应用程序。 Everything works perfectly on my professional computer (running on Ubuntu 12.04) but I would like to work on the project at home during my holidays. 一切都可以在我的专业计算机上完美运行(在Ubuntu 12.04上运行),但我想在假期在家中进行该项目。 Thus, I have copied the project on my personal computer (running on mac os x 10.6.8). 因此,我已经在个人计算机上复制了该项目(在mac os x 10.6.8上运行)。 The problem is I always get blank pages. 问题是我总是得到空白页。 It does not look to be a rewrite problem since even with the ugly address, it does not work. 它看起来不是重写问题,因为即使地址很丑,它也不起作用。
Please find below files and information that might be useful to fix the issue. 请找到以下文件和信息,可能对解决此问题有用。
Folder structure (/Users/Yoann/Sites/DS) 文件夹结构(/用户/ Yoann /站点/ DS)
-.htaccess
- index.php
- vendor/
- utils/
- services/
The utils and services directories contain some php classes and are not of interest to fix my issue. utils和services目录包含一些php类,对解决我的问题不感兴趣。
.htaccess .htaccess
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ /index.php [QSA,L]
index.php (sample) index.php(示例)
<?php
require_once 'vendor/autoload.php';
function autoload_class_multiple_directory($class_name)
{
# List all the class directories in the array.
$array_paths = array(
'utils/',
'services/'
);
foreach($array_paths as $path)
{
$file = sprintf('./%s%s.class.php', $path, strtolower($class_name));
if(is_file($file))
{
include_once $file;
}
}
}
spl_autoload_register('autoload_class_multiple_directory');
error_reporting(E_ALL);
ini_set('display_errors','On');
$app = new \Slim\Slim(array(
"MODE" => "debug"
));
/* **********************************
* ROUTE DEFINITIONS
* **********************************/
$arrDs = array("generator" => new Generator(),
"average" => new Average()
);
$app->get('/', function () use ($app,$arrDs){
echo "dans la fonction de base !!! <br/>";
foreach ($arrDs as $name => $obj){
echo $name ."<br/>";
}
});
$app->run();
?>
I am using a virtual host defined as 我正在使用定义为
<VirtualHost *:80>
ServerAdmin [email blocked]
DocumentRoot "/Users/Yoann/Sites/DS"
ServerName ds.local
ErrorLog "/private/var/log/apache2/ds-error_log"
CustomLog "/private/var/log/apache2/ds-access_log" combined
<Directory "/Users/Yoann/Sites/DS">
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
In development environment always set error_reporting to E_ALL and display_errors to true. 在开发环境中,始终将error_reporting设置为E_ALL并将display_errors设置为true。
php.ini:
display_errors = On
error_reporting = E_ALL
You'll see all errors, warnings, etc ... 您会看到所有错误,警告等...
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.