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