本文整理匯總了PHP中Redirect::go方法的典型用法代碼示例。如果您正苦於以下問題:PHP Redirect::go方法的具體用法?PHP Redirect::go怎麽用?PHP Redirect::go使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Redirect
的用法示例。
在下文中一共展示了Redirect::go方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: logout
function logout()
{
session_start();
session_destroy();
require 'Conn/Redirect.php';
$redirect = new Redirect();
$redirect->go('index.php?page=login');
}
示例2: create
function create()
{
require 'Conn/Redirect.php';
$redirect = new Redirect();
if (isset($_POST["name"]) && isset($_POST["pwd"]) && $_POST["pwd"] == $_POST["confirm"]) {
$name = $_POST["name"];
require_once 'Conn/Mysql.php';
$mysql = new Mysql();
$mysql->query("select * from users where name ='{$name}';");
$count = $mysql->get_count();
if (isset($count) && $count == 1) {
$error = "用戶名已存在!";
require_once 'View/register.php';
} else {
$pwd = md5($_POST["pwd"]);
$mysql->query("insert into users (name,pwd,created) values ('{$name}','{$pwd}',NOW());");
session_start();
$_SESSION['user'] = $name;
$redirect->go('index.php');
}
} else {
$redirect->go('index.php?page=register');
}
}
示例3: setMessage
function setMessage()
{
$usered = $_POST["user"];
if ($usered != "") {
session_start();
$user = $_SESSION['user'];
$message = $_POST["message"];
require_once 'Conn/Mysql.php';
$mysql = new Mysql();
$mysql->query("INSERT INTO `message`(`message`, `user_id`, `usered_id`, `created`) VALUES ('{$message}',(select id from users where name='{$user}'),(select id from users where name='{$usered}'),NOW());");
require 'Conn/Redirect.php';
$redirect = new Redirect();
$redirect->go("index.php?page=chat&user={$usered}");
} else {
echo "不能為空";
}
}
示例4: index
function index()
{
session_start();
if (!isset($_SESSION['user'])) {
require 'Conn/Redirect.php';
$redirect = new Redirect();
$redirect->go('index.php?page=login');
} else {
$index = isset($_GET['index']) ? $_GET['index'] : 0;
$start = $index * 10;
require_once 'Conn/Mysql.php';
$mysql = new Mysql();
$mysql->query("select name from users;");
$count = $mysql->get_count();
$mysql->query("select name from users limit {$start},10;");
$user = $_SESSION['user'];
require "View/Home.php";
}
}