本文整理匯總了PHP中USER::getAllUsers方法的典型用法代碼示例。如果您正苦於以下問題:PHP USER::getAllUsers方法的具體用法?PHP USER::getAllUsers怎麽用?PHP USER::getAllUsers使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類USER
的用法示例。
在下文中一共展示了USER::getAllUsers方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: session_start
<?php
require_once "src/connection.php";
session_start();
if (isset($_SESSION['user']) == false) {
header("loacation: login.php");
}
$y = USER::getAllUsers();
echo '<pre>';
var_dump($y);
echo '</pre>';
foreach ($y as $user) {
echo "{$user->getid()} <br> {$user->getEmail()}<br>";
}
示例2: dirname
<?php
require_once dirname(dirname(__FILE__)) . '/config.php';
require SITE_ROOT . '/PHP/User.php';
require SITE_ROOT . '/PHP/check_logged_in.php';
$t = $_SESSION['user']->getIsAdmin();
if ($t != true) {
$_SESSION['user']->logout();
header('Location: ' . SITE_LOGIN_PAGE);
}
$users = USER::getAllUsers();
$message = '';
$message_class = 'hidden';
/*
Determines what is input into the form and creates
a new user, upon success, the user will be created
and success will be written on the screen
The second part of the case is if a user is deleted
upon success, the user will be removed from the database
and success will be written on the screen
*/
if (isset($_POST['form'])) {
switch ($_POST['form']) {
case 'AddUser':
try {
if (isset($_POST['admin'])) {
$admin = true;
} else {
$admin = false;
}