我在本地机器上安装了 CodeIgniter。我hosts
在 Windows 和 Apache 配置中使用了文件来使其在我的真实域名下工作(例如。site.com
)。效果很好,所以今天我把所有东西都上传到了我的主机上。我更改了hosts
Apache 配置,通过刷新 DNS ipconfig /flushdns
,现在输入某些 URL(games
)给了我 404。
我的控制器名称以大写开头,但我的路由设置如下:
$route['Games/(:num)/(:any)'] = 'Games/Game/$1';
$route['games/(:num)/(:any)'] = 'Games/Game/$1';
通过输入games/14/game
或Games/14/game
不起作用。
搜索图像(使用merahulpk 给出的解决方案)也不起作用。
会是什么?
不幸的是,它仍在开发中,所以我现在还不能给你地址。
- 编辑 -
图像包含脚本:
views/game.php
<?php
$image_path = $this->config->item('base_path').'images/games/'.$info['id'].'-s.jpg';
if(file_exists($image_path)) {
$small = $this->config->item('base_url').'images/games/'.$info['id'].'-s.jpg';
$big = $this->config->item('base_url').'images/games/'.$info['id'].'-b.jpg';
} else {
$small = $this->config->item('base_url').'images/games/none-m.png';
$big = $this->config->item('base_url').'images/games/none-m.png';
}
?>
config/sit-config.php
<?php
$config['base_url'] = "http://".$_SERVER['SERVER_NAME'] . str_replace(basename($_SERVER['SCRIPT_NAME']),"",$_SERVER['SCRIPT_NAME']);
if(!defined('DOCUMENT_ROOT')) define('DOCUMENT_ROOT',str_replace('system/application/config','',substr(__FILE__, 0, strrpos(__FILE__, '/'))));
$config['base_path'] = constant("DOCUMENT_ROOT");
?>