本文整理汇总了PHP中Alias::setType方法的典型用法代码示例。如果您正苦于以下问题:PHP Alias::setType方法的具体用法?PHP Alias::setType怎么用?PHP Alias::setType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Alias
的用法示例。
在下文中一共展示了Alias::setType方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Alias
$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.";
}
}
} else {
示例2: getConnection
adminPage();
$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>';
}
}
示例3: pa
pa($file);
}
if (issetOrBlank($_POST['file-alias']) != "") {
$alias = new Alias($conn);
$fileAlias = issetOrBlank($_POST['file-alias']);
if (!startsWith($fileAlias, "/")) {
$fileAlias = "/" . $fileAlias;
}
$alias->setAlias($fileAlias);
//must start with '/'
//check if alias already exists first
//pa( $alias->getObjectsLikeThis() );
//echo sizeof( $alias->getObjectsLikeThis() );
$numAliases = sizeof($alias->getObjectsLikeThis());
$alias->setPointer($file->getId());
$alias->setType("file");
if ($alias->getAlias() != "/" && $numAliases == 0 && $alias->save() > 0) {
echo '<h1>Alias created OK!</h1>';
$file->setAliasID($alias->getId());
if ($file->save() > 0) {
echo '<p>File Updated</p>';
}
} 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>';