这是我的站点链接,当我尝试在网络中登录时,我得到的响应是整个 login.php 代码,而不是执行 php 文件后的响应。我的 app.yaml 文件是正确的,我已经仔细检查过了。我的 php 文件无法在谷歌云服务中执行。
这是我的 app.yaml 代码
runtime: php55
api_version: 1
threadsafe: yes
handlers:
- url: /favicon\.ico
static_files: favicon.ico
upload: favicon\.ico
- url: /css
static_dir: css
- url: /images
static_dir: images
- url: /fonts
static_dir: fonts
- url: /utils
static_dir: utils
- url: /js
static_dir: js
- url: /index.html
script: /index.html
- url: /signup.html
script: /signup.html
- url: /.*
script: index.html
- url: /utils/login.php
script: /utils/login.php
- url: /js/login.js
script: /js/login.js
- url: /js/script.js
script: /js/script.js
- url: /js/jquery.min
script: /js/jquery.min
- url: /js/bootstrap.min
script: /js/bootstrap.min
- url: .*
script: main.php
这是我的 login.php 代码
<?php
require 'dblinker.php';
function login(){
try {
$username = $_POST['username'];
$password = $_POST['password'];
// login function
$handle=$conn->prepare("SELECT * FROM `users` WHERE `username`= :username AND `password`= :password");
$handle->bindParam('username', $username, PDO::PARAM_STR);
$handle->bindParam('password', $password, PDO::PARAM_STR);
$handle->execute();
if($handle->rowCount() == 1){
$result=$handle->fetch(PDO::FETCH_ASSOC);
$_SESSION["username"] = $result['username'];
$_SESSION["role_id"] = $result['role_id'];
echo "success";
}else{
echo "fail";
}
}
catch(Exception $e){
echo "F";
}
}
session_start();
echo login();
?>