本文整理汇总了PHP中Utilities::log方法的典型用法代码示例。如果您正苦于以下问题:PHP Utilities::log方法的具体用法?PHP Utilities::log怎么用?PHP Utilities::log使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Utilities
的用法示例。
在下文中一共展示了Utilities::log方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fileExists
static function fileExists($file)
{
$page = self::getFilePath($file);
if (!file_exists($page)) {
Utilities::log("Cannot find file for render {$page}");
return false;
}
return true;
}
示例2: load
public function load($file)
{
$file = ROOT . '/lang/' . $file . '.' . self::LANG_FILE_EXT;
if (!file_exists($file)) {
Utilities::log("Cannot access lang file {$file}", Utilities::LOG_E);
die;
}
$this->lang = parse_ini_file($file);
if (!$this->lang) {
Utilities::log("Cannot parse ini file {$file}", Utilities::LOG_E);
die;
}
}
示例3: getInstance
public static function getInstance()
{
if (DB::$INSTANCE == null) {
$dsn = "mysql:host=" . Config::DB_HOST . ";dbname=" . Config::DB_NAME;
try {
DB::$INSTANCE = new PDO($dsn, Config::DB_USER, Config::DB_PASS, array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC));
} catch (PDOException $e) {
$str = "Cannot connect to database " . $e->getMessage();
Utilities::log($str, Utilities::LOG_E);
die;
}
}
return DB::$INSTANCE;
}
示例4: load
public static function load()
{
self::$sid = self::getSid();
$data = Db::getUserBySid(self::$sid);
self::$id = $data['id'];
self::$rid = $data['rid'];
self::$ip = $data['ip'];
self::$token = Generator::token();
$newIp = self::getIp();
if (self::$ip != $newIp) {
Utilities::log("Loaded existing user, different IP " . self::toString());
self::$ip = $newIp;
} else {
Utilities::log("Loaded existing user, same IP " . self::toString());
}
DB::updateUserById(self::$id, self::$rid, $newIp, self::$sid, self::$token);
}
示例5: formatRid
public static function formatRid($rid, $format = Config::RID_DEFAULT_FORMAT)
{
if (substr_count($format, Config::RID_FORMAT_NUMBER) != Config::RID_LENGTH) {
debug("Wrong count of number in format supplied for Generator::formatRid");
}
if (substr_count($format, Config::RID_FORMAT_NUMBER) != strlen($rid)) {
Utilities::log("Rid.length < Format.length in Generator.formantRid({$rid}, {$format})", Utilities::LOG_W);
return $rid;
}
$ridIndex = 0;
$output = "";
for ($i = 0; $i < strlen($format); $i++) {
if ($format[$i] == "n") {
$output .= $rid[$ridIndex++];
} else {
$output .= $format[$i];
}
}
return $output;
}
示例6: switch
$action = Utilities::postOrNull('action');
$token = Utilities::postOrNull('token');
$rid = Utilities::postOrNull('rid');
$page = Utilities::postOrNull('page');
User::construct($rid, $token);
if ($action == null) {
Utilities::log("handler: Action is null " . User::toString(), Utilities::LOG_E);
Ajax::sendError();
}
switch ($action) {
case Config::AJAX_ACTION_GENERATE_RID:
$data = Ajax::generateRid();
break;
case Config::AJAX_ACTION_GENERATE_NUMBER:
$data = Ajax::generateNumber();
break;
case Config::AJAX_ACTION_CHECK_RID:
$data = Ajax::checkRid();
break;
case Config::AJAX_ACTION_CHECK_USER:
$data = Ajax::checkUser();
break;
case Config::AJAX_ACTION_GET_PAGE:
$data = Ajax::getPage($page);
break;
default:
Utilities::log("Incorrect action {$action} " . User::toString(), Utilities::LOG_E);
Ajax::sendError();
}
DB::close();
exit($data);
示例7: actRidFormat
public static function actRidFormat()
{
if (User::$rid == null) {
Utilities::log("RID is null " . User::toString(), Utilities::LOG_E);
self::sendError(2);
}
if (!Generator::checkRidFormat(User::$rid)) {
Utilities::log("Incorrect RID format " . User::toString(), Utilities::LOG_E);
self::sendError(0);
}
}
示例8: log
* F6 (Windows/Linux/Mac OS X)
*/
namespace Refactoring11\JetBrains;
// 1. Move the current file into the Code directory.
// 2. Move the Code directory and all its contents into the MoreCode directory.
// 3. Move Class1, Class2 and Class3 into separate files.
class Class1
{
}
class Class2
{
}
class Class3
{
}
// 4. Move the static method log() from the Utilities class to the Logger class.
class Utilities
{
public static function log($message)
{
echo $message;
}
}
class Logger
{
}
// 5. Note that the calls to Utilities::log() have been updated.
Utilities::log('Almost at the end of the exercise');
Utilities::log('At the end of the exercise');