本文整理匯總了PHP中Value::SetAndNotEmpty方法的典型用法代碼示例。如果您正苦於以下問題:PHP Value::SetAndNotEmpty方法的具體用法?PHP Value::SetAndNotEmpty怎麽用?PHP Value::SetAndNotEmpty使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Value
的用法示例。
在下文中一共展示了Value::SetAndNotEmpty方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: GetArgumentSafely
/**
* Retrieves a GET value after sanitizing it
* @param id, The name of the GET value to retrieve.
* @param keephtml, Disables the HTML part of the sanitization (not reccomended).
*/
public static function GetArgumentSafely($id, $keephtml = false)
{
$return = EMPTYSTRING;
if (Value::SetAndNotEmpty($_GET, $id)) {
$return = _string::Sanitize($_GET[$id], $keephtml);
}
return $return;
}
示例2: Insert
public static function Insert($message, $recipe, $id = EMPTYSTRING)
{
$result = false;
if (Site::HasHttps() && Login::IsLoggedIn()) {
if (Value::SetAndNotEmpty($message) && Value::SetAndNotNull($recipe)) {
$path = 'R=' . $recipe;
if ($id != EMPTYSTRING) {
if ($stmt = Database::GetLink()->prepare('SELECT `comment_path` FROM `Comment` WHERE `comment_path` LIKE ?;')) {
$stmt->bindParam(1, $path, PDO::PARAM_STR, 255);
$stmt->execute();
$stmt->bindColumn(1, $result);
$stmt->fetch();
$stmt->closeCursor();
if ($result != null && _string::StartsWith($result, $path)) {
$path = $result . '>' . $id;
} else {
$path = null;
}
}
}
if ($path != null) {
$userid = Login::GetId();
$timestamp = time();
if ($stmt = Database::GetLink()->prepare('INSERT INTO `Comment` (`user_id`, `comment_path`, `comment_contents`, `sent_at`) VALUES (?, ?, ?, ?);')) {
$stmt->bindParam(1, $userid, PDO::PARAM_INT);
$stmt->bindParam(2, $path, PDO::PARAM_STR, 255);
$stmt->bindParam(3, $message, PDO::PARAM_STR, 255);
$stmt->bindParam(4, $timestamp, PDO::PARAM_INT);
$stmt->execute();
$stmt->closeCursor();
}
}
}
}
return $result;
}