我已经创建了一个代码点火器PHP项目,我需要它部署到谷歌应用程序引擎。到目前为止,我已经像下面这样配置了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文件中有一个名为"login"的链接,当我点击登录.php页面加载时。代码如下:
<a href=<?php echo site_url('welcome/login'); ?>><i class="fa fa-lock"></i> Login</a>
我的欢迎控制器类如下所示:
<?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"链接后,它将加载登录页面,但不应用样式表。我找不到问题所在。是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">
在绝对url和相对url中解释了它们的区别(但请注意,这里您很可能希望使用绝对形式,而不是该问题中推荐的相对形式)。