PHP require_once在我的代码中不起作用

时间:2019-06-20 03:07:59

标签: javascript php html sql mysqli

我正在尝试为员工创建一个登录系统,该系统使用google api进行密码验证和数据库表来标识管理员。每当我将php代码和require_once放在页面顶部的HTML之前时,我都会收到一个错误500或该html没有加载到该页面上,并且留下空白网页。当我取出require_once时,我的html运行良好。

我尝试使用include“ config.php”代替require_once,并且还尝试将我的代码从“ config.php”硬编码到PHP年龄,但这也不起作用。

            <?php
                require_once "config.php";

                $loginURL = $gClient->createAuthUrl();
            ?>

            <!doctype html>
            <html lang="en">
                <head>
                    <meta cahrset="UTF-8">
                    <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1">
                    <meta http-equiv="X-UA-Compatible" content="ie=edge">
                    <title>login with google</title>
                    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
                </head>
                    <body>

                        <div class="container" style="margin-top: 100px">
                            <div class="row justify-content-center">
                                <div class="col-md-6 col-offset-3" align="center">

                                <form>
                                    <input placeholder="Email..." name="email" class="form-control"><br><br>
                                    <input type="password" placeholder="Password..." name="password" class="form-control"><br><br>
                                    <input type="submit" value="Log In" class="btn btn-primary">
                                    <input type="button" onclick="window.location ='<?php echo $loginURL ?>';" value="Log In With Google" class="btn btn-danger">
                                </form>
                                </div>
                            </div>
                        </div>

                    </body>
            </html>

0 个答案:

没有答案