我创建了一个代码点火器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文件中有一个名为“login”的链接,当我点击它时,加载了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页面上的“登录”链接后,它会加载登录页面但不应用样式表。我找不到问题所在。它是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-->
答案 0 :(得分:2)
使引用绝对。即,而不是相对形式
<link href="css/bootstrap.min.css" rel="stylesheet">
使用
<link href="/css/bootstrap.min.css" rel="stylesheet">
差异在Absolute vs relative URLs中解释(但请注意,您最有可能想要绝对形式,而不是该问题中推荐的相对形式)。