本文整理汇总了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";
}
}