本文整理汇总了PHP中Alias::setPointer方法的典型用法代码示例。如果您正苦于以下问题:PHP Alias::setPointer方法的具体用法?PHP Alias::setPointer怎么用?PHP Alias::setPointer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Alias
的用法示例。
在下文中一共展示了Alias::setPointer方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getConnection
$conn = getConnection();
if (strtoupper($_SERVER['REQUEST_METHOD']) == 'POST') {
$aliasText = issetOrBlank($_POST['alias']);
$pointer = issetOrBlank($_POST['pointer']);
//echo "Alias: ".$alias.", pointer: ".$pointer;
if ($aliasText != "" && $pointer != "") {
//we can add them if the alias doesn't already exist.
if (!startsWith($aliasText, "/")) {
$aliasText = "/" . $aliasText;
}
$alias = new Alias($conn);
$alias->setAlias($aliasText);
//must start with '/'
$numAliases = sizeof($alias->getObjectsLikeThis());
$alias->setType("url");
$alias->setPointer($pointer);
if ($alias->getAlias() != "/" && $numAliases == 0 && $alias->save() > 0) {
echo '<h1>Alias created OK!</h1>';
echo $alias->getAlias() . " will now 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 {
echo '<p>Couldnt save...</p>';
}
}
}
示例2: Alias
$fileUpdate->setAliasID(0);
$aliasUpdate = "DELETE FROM `alias` where `id` = :ALIASID";
$aliasUpdate = $conn->prepare($aliasUpdate);
$aliasUpdate->bindParam(':ALIASID', $file->getAliasID());
if ($aliasUpdate->execute()) {
echo "Alias deleted Successfully.";
}
} else {
//new or Update
//ensure it is available!
$alias = new Alias($conn);
$alias->setAlias($fileAlias);
$numAliases = sizeof($alias->getObjectsLikeThis());
if ($numAliases == 0) {
if ($file->getAliasID() == 0) {
$alias->setPointer($file->getId());
$alias->setType('file');
if ($alias->save() > 0) {
//echo "Alias Saved";
$fileUpdate->setAliasID($alias->getId());
}
} else {
$aliasUpdate = "UPDATE `alias` set `alias` = :NEWALIAS where `id` = :ALIASID";
$aliasUpdate = $conn->prepare($aliasUpdate);
$aliasUpdate->bindParam(':NEWALIAS', $fileAlias);
$aliasUpdate->bindParam(':ALIASID', $file->getAliasID());
$fileUpdate->setAliasID($file->getAliasID());
if ($aliasUpdate->execute() > 0) {
//echo "Alias updated Successfully.";
}
}