代码点火器无法在移动设备中加载请求的文件


Codeigniter unable to load the requested file in a mobile device

每当我在移动设备中加载网站时,我都会在代码点火器中收到Unable to load the requested file: default.php错误。它在桌面浏览器中完美加载。

这是我的控制器是如何设置的,

class Welcome extends CI_Controller {
    public function index()
    {
        $this->template->set_layout('default')->build('welcome_en');
    }
}

默认值是我用于"welcome_en"视图页面的当前模板的 Sparks 模板。

我一直在尝试解决这个问题一段时间了,没有使用用户代理检测脚本,以前有,但我把它拿出来希望摆脱错误。

您可能需要创建 Web 和移动文件夹。更多信息

而不是application/views/layouts/default.php尝试application/views/web/layouts/default.phpapplication/views/mobile/layouts/default.php.

对于所有其他布局文件也是如此,如果您浏览到包含CodeIgniter认为是手机(不是iPad)的任何内容的页面,它们将加载移动版本。