當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Alias::setType方法代碼示例

本文整理匯總了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 {
開發者ID:bren1818,項目名稱:fileupload,代碼行數:31,代碼來源:modifyFile.php

示例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>';
                }
            }
開發者ID:bren1818,項目名稱:fileupload,代碼行數:31,代碼來源:addAlias.php

示例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>';
開發者ID:bren1818,項目名稱:fileupload,代碼行數:31,代碼來源:addFile.php


注:本文中的Alias::setType方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。