本文整理匯總了PHP中Alias::setId方法的典型用法代碼示例。如果您正苦於以下問題:PHP Alias::setId方法的具體用法?PHP Alias::setId怎麽用?PHP Alias::setId使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Alias
的用法示例。
在下文中一共展示了Alias::setId方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: Alias
if (!startsWith($aliasText, "/")) {
$aliasText = "/" . $aliasText;
}
$alias = new Alias($conn);
$alias->setAlias($aliasText);
//must start with '/'
$numAliases = sizeof($alias->getObjectsLikeThis());
if ($numAliases != 0) {
//is this because we only updated the pointer, or because it actually already exists?
//simple check, if the hash with the new aliasText is the same as the old, it's just an update
if ($key == hash('md5', KEY . $alias->getAlias())) {
$numAliases = 0;
}
}
$alias->setPointer($pointer);
$alias->setId($aliasID);
if ($alias->getAlias() != "/" && $numAliases == 0 && $alias->save() > 0) {
echo '<h1>Alias Saved OK!</h1>';
if ($alias->getType() != "url") {
echo $alias->getAlias() . " will point to file ID: " . $pointer;
} else {
echo $alias->getAlias() . " will point to: " . $pointer;
}
} else {
if ($numAliases > 0) {
echo '<p>The Alias: ' . $alias->getAlias() . ' already exists</p>';
} else {
if ($alias->getAlias() == "/") {
echo '<p>Alias cannot be saved as /</p>';
//shouldnt occur
} else {