我正在开发一个用于Web应用程序的项目现在我的问题是我有一个包含一个views文件夹的登录脚本。在view
文件夹里面我有三个PHP文件:
logged-in.php
not_logged_in.php
register.php
除了我的view
文件夹,我有一个文件index.php
现在可以查看此图片click here。
现在,当我运行index.php
文件时,如果用户未登录则显示登录主页面,否则将显示主页(视图文件夹中为logged-in.php
)如果我直接运行{{直接1}}文件然后它会给出一个错误,所以整个过程我必须用logged-in.php
启动。
以下是index.php
index.php
看看这个pic,问题是我想在<?php
// checking for minimum PHP version
if (version_compare(PHP_VERSION, '5.3.7', '<')) {
exit("Sorry, Simple PHP Login does not run on a PHP version smaller than 5.3.7 !");
} else if (version_compare(PHP_VERSION, '5.5.0', '<')) {
// if you are using PHP 5.3 or PHP 5.4 you have to include the password_api_compatibility_library.php
// (this library adds the PHP 5.5 password hashing functions to older versions of PHP)
require_once("libraries/password_compatibility_library.php");
}
// include the configs / constants for the database connection
require_once("config/db.php");
// load the login class
require_once("classes/Login.php");
// create a login object. when this object is created, it will do all login/logout stuff automatically
// so this single line handles the entire login process. in consequence, you can simply ...
$login = new Login();
// ... ask if we are logged in here:
if ($login->isUserLoggedIn() == true) {
// the user is logged in. you can do whatever you want here.
// for demonstration purposes, we simply show the "you are logged in" view.
include("views/logged_in.php");
} else {
// the user is not logged in. you can do whatever you want here.
// for demonstration purposes, we simply show the "you are not logged in" view.
include("views/not_logged_in.php");
}
内调用comment-folder
,所以我在登录的.php中使用logged-in.php
作为你可以看到我的照片。
但是当我运行它时会显示注释弹出窗口,但是当我点击include('comment05/../.. .php');
按钮时,它会给出错误comment
,这意味着它正在识别正确的路径。所以我想问一下,我是否需要将某些内容更改为404 file not found
文件?因为我想我需要使用index.php
等等来改变他们喜欢的东西。
那么你可以帮助我使用include('comment05')
文件,当我将文件夹调入index.php
文件时,我应该怎么办,因为整个过程都依赖于logged-in.php
文件?我的意思是我的网站首先启动index.php
。