本文整理汇总了PHP中UserController::getInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP UserController::getInstance方法的具体用法?PHP UserController::getInstance怎么用?PHP UserController::getInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserController
的用法示例。
在下文中一共展示了UserController::getInstance方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
function __construct()
{
parent::__construct("../../model/events.json");
$this->userController = UserController::getInstance();
}
示例2: session_start
<?php
if (!isset($_SESSION)) {
session_start();
}
require_once "../../UserController.php";
$userController = UserController::getInstance();
$firstName = $_SESSION["brukernavn"];
$image = $_POST["profilbilde"];
$farge = $_POST["farge"];
$error = false;
if ($farge == "" and $image != "") {
//lagre bilde
$success = file_put_contents("../resources/images/users/" . $firstName, $image);
}
if ($image == "" and $farge != "") {
//lagre farge
$success = $userController->setUserColor($firstName, $farge);
$_SESSION["farge"] = $farge;
}
if ($farge != "" and $image != "") {
//lagre bilde og farge
$success = file_put_contents("../resources/images/users/" . $firstName, $image);
$success = $userController->setUserColor($firstName, $farge);
$_SESSION["farge"] = $farge;
}
echo $success;
示例3:
}
if ( $this->user->login( $connection ) ) {
$this->session = SessionController::getInstance();
$this->session->setMessage( "Welcome back {$this->user->username}");
$this->session->setupAuthorizedSession( $this->user );
} else {
echo "not logged in";
print_r( $this->user);
}
}
}
if(!isset($application)){
$application = ApplicationController::getInstance();
}
$userProcessor = UserController::getInstance();
$message = $_REQUEST[ 'message'];
switch( $message ) {
case 'registration':
$userProcessor->registration( $application->getDatabaseConnection() );
break;
case 'login':
$userProcessor->login( $application->getDatabaseConnection() );
break;
default:
break;
}
?>