app.yaml 只为 CodeIgniter 中的 index.php 文件加载 css
app.yaml loads the css only for index.php file in CodeIgniter
我创建了一个 code-ignitor PHP 项目,我需要将其部署到 Google 应用引擎。到目前为止,我已经配置了 app.yaml 如下
application: the-new-test-project
version: 1
runtime: php55
api_version: 1
#threadsafe: yes
handlers:
- url: /css
static_dir: application/views/css
- url: /images
static_dir: application/views/images
- url: /js
static_dir: application/views/js
- url: /fonts
static_dir: application/views/fonts
- url: /.*
script: index.php
在 运行 我的项目使用 Google 应用程序引擎启动器后,它使用应用的样式表很好地加载了 index.php 页面。我在我的 index.php 文件中 link 调用了 "login",当我单击时 login.php 页面被加载。该代码如下:
<a href=<?php echo site_url('welcome/login'); ?>><i class="fa fa-lock"></i> Login</a>
我的欢迎控制器 class 如下所示:
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Welcome extends CI_Controller {
public function index()
{
$this->load->view('index');
}
public function login()
{
$this->load->view('login');
}
}
在 index.php 页面上单击 "login" link 后,它加载登录页面但不应用样式表。我找不到问题所在。是 app.yaml 文件还是我在 php 文件中做了一些愚蠢的事情?请帮忙..
login.php 头部如下:
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">
<title>Login | E-Shopper</title>
<link href="css/bootstrap.min.css" rel="stylesheet">
<link href="css/font-awesome.min.css" rel="stylesheet">
<link href="css/prettyPhoto.css" rel="stylesheet">
<link href="css/price-range.css" rel="stylesheet">
<link href="css/animate.css" rel="stylesheet">
<link href="application/viewscss/main.css" rel="stylesheet">
<link href="css/responsive.css" rel="stylesheet">
<!--[if lt IE 9]>
<script src="js/html5shiv.js"></script>
<script src="js/respond.min.js"></script>
<![endif]-->
<link rel="shortcut icon" href="images/ico/favicon.ico">
<link rel="apple-touch-icon-precomposed" sizes="144x144" href="images/ico/apple-touch-icon-144-precomposed.png">
<link rel="apple-touch-icon-precomposed" sizes="114x114" href="images/ico/apple-touch-icon-114-precomposed.png">
<link rel="apple-touch-icon-precomposed" sizes="72x72" href="images/ico/apple-touch-icon-72-precomposed.png">
<link rel="apple-touch-icon-precomposed" href="images/ico/apple-touch-icon-57-precomposed.png">
</head><!--/head-->
使引用成为绝对引用。即,而不是相对形式
<link href="css/bootstrap.min.css" rel="stylesheet">
使用
<link href="/css/bootstrap.min.css" rel="stylesheet">
差异在 Absolute vs relative URLs 中进行了解释(但请注意,您很可能需要此处的绝对形式,而不是该问题中推荐的相对形式)。
我创建了一个 code-ignitor PHP 项目,我需要将其部署到 Google 应用引擎。到目前为止,我已经配置了 app.yaml 如下
application: the-new-test-project
version: 1
runtime: php55
api_version: 1
#threadsafe: yes
handlers:
- url: /css
static_dir: application/views/css
- url: /images
static_dir: application/views/images
- url: /js
static_dir: application/views/js
- url: /fonts
static_dir: application/views/fonts
- url: /.*
script: index.php
在 运行 我的项目使用 Google 应用程序引擎启动器后,它使用应用的样式表很好地加载了 index.php 页面。我在我的 index.php 文件中 link 调用了 "login",当我单击时 login.php 页面被加载。该代码如下:
<a href=<?php echo site_url('welcome/login'); ?>><i class="fa fa-lock"></i> Login</a>
我的欢迎控制器 class 如下所示:
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Welcome extends CI_Controller {
public function index()
{
$this->load->view('index');
}
public function login()
{
$this->load->view('login');
}
}
在 index.php 页面上单击 "login" link 后,它加载登录页面但不应用样式表。我找不到问题所在。是 app.yaml 文件还是我在 php 文件中做了一些愚蠢的事情?请帮忙..
login.php 头部如下:
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">
<title>Login | E-Shopper</title>
<link href="css/bootstrap.min.css" rel="stylesheet">
<link href="css/font-awesome.min.css" rel="stylesheet">
<link href="css/prettyPhoto.css" rel="stylesheet">
<link href="css/price-range.css" rel="stylesheet">
<link href="css/animate.css" rel="stylesheet">
<link href="application/viewscss/main.css" rel="stylesheet">
<link href="css/responsive.css" rel="stylesheet">
<!--[if lt IE 9]>
<script src="js/html5shiv.js"></script>
<script src="js/respond.min.js"></script>
<![endif]-->
<link rel="shortcut icon" href="images/ico/favicon.ico">
<link rel="apple-touch-icon-precomposed" sizes="144x144" href="images/ico/apple-touch-icon-144-precomposed.png">
<link rel="apple-touch-icon-precomposed" sizes="114x114" href="images/ico/apple-touch-icon-114-precomposed.png">
<link rel="apple-touch-icon-precomposed" sizes="72x72" href="images/ico/apple-touch-icon-72-precomposed.png">
<link rel="apple-touch-icon-precomposed" href="images/ico/apple-touch-icon-57-precomposed.png">
</head><!--/head-->
使引用成为绝对引用。即,而不是相对形式
<link href="css/bootstrap.min.css" rel="stylesheet">
使用
<link href="/css/bootstrap.min.css" rel="stylesheet">
差异在 Absolute vs relative URLs 中进行了解释(但请注意,您很可能需要此处的绝对形式,而不是该问题中推荐的相对形式)。