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


PHP TimeDate::httptime方法代碼示例

本文整理匯總了PHP中TimeDate::httptime方法的典型用法代碼示例。如果您正苦於以下問題:PHP TimeDate::httptime方法的具體用法?PHP TimeDate::httptime怎麽用?PHP TimeDate::httptime使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在TimeDate的用法示例。


在下文中一共展示了TimeDate::httptime方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: http_PROPFIND


//.........這裏部分代碼省略.........
     echo "<D:multistatus xmlns:D=\"DAV:\">\n";
     foreach ($files["files"] as $file) {
         // ignore empty or incomplete entries
         if (!is_array($file) || empty($file) || !isset($file["path"])) {
             continue;
         }
         $path = $file['path'];
         if (!is_string($path) || $path === "") {
             continue;
         }
         echo " <D:response {$ns_defs}>\n";
         $href = @$_SERVER["HTTPS"] === "on" ? "https:" : "http:";
         $href .= "//" . $_SERVER['HTTP_HOST'] . $_SERVER['SCRIPT_NAME'];
         $href .= $path;
         //TODO make sure collection resource pathes end in a trailing slash
         echo "  <D:href>{$href}</D:href>\n";
         // report all found properties and their values (if any)
         if (isset($file["props"]) && is_array($file["props"])) {
             echo "   <D:propstat>\n";
             echo "    <D:prop>\n";
             foreach ($file["props"] as $key => $prop) {
                 if (!is_array($prop)) {
                     continue;
                 }
                 if (!isset($prop["name"])) {
                     continue;
                 }
                 if (!isset($prop["val"]) || $prop["val"] === "" || $prop["val"] === false) {
                     // empty properties (cannot use empty() for check as "0" is a legal value here)
                     if ($prop["ns"] == "DAV:") {
                         echo "     <D:{$prop['name']}/>\n";
                     } else {
                         if (!empty($prop["ns"])) {
                             echo "     <" . $ns_hash[$prop["ns"]] . ":{$prop['name']}/>\n";
                         } else {
                             echo "     <{$prop['name']} xmlns=\"\"/>";
                         }
                     }
                 } else {
                     if ($prop["ns"] == "DAV:") {
                         // some WebDAV properties need special treatment
                         switch ($prop["name"]) {
                             case "creationdate":
                                 echo "     <D:creationdate ns0:dt=\"dateTime.tz\">" . gmdate("Y-m-d\\TH:i:s\\Z", $prop['val']) . "</D:creationdate>\n";
                                 break;
                             case "getlastmodified":
                                 echo "     <D:getlastmodified ns0:dt=\"dateTime.rfc1123\">" . TimeDate::httptime($prop['val']) . "</D:getlastmodified>\n";
                                 break;
                             case "resourcetype":
                                 echo "     <D:resourcetype><D:{$prop['val']}/></D:resourcetype>\n";
                                 break;
                             case "supportedlock":
                                 echo "     <D:supportedlock>{$prop['val']}</D:supportedlock>\n";
                                 break;
                             case "lockdiscovery":
                                 echo "     <D:lockdiscovery>\n";
                                 echo $prop["val"];
                                 echo "     </D:lockdiscovery>\n";
                                 break;
                             default:
                                 echo "     <D:{$prop['name']}>" . $this->_prop_encode(htmlspecialchars($prop['val'])) . "</D:{$prop['name']}>\n";
                                 break;
                         }
                     } else {
                         // properties from namespaces != "DAV:" or without any namespace
                         if ($prop["ns"]) {
                             echo "     <" . $ns_hash[$prop["ns"]] . ":{$prop['name']}>" . $this->_prop_encode(htmlspecialchars($prop['val'])) . "</" . $ns_hash[$prop["ns"]] . ":{$prop['name']}>\n";
                         } else {
                             echo "     <{$prop['name']} xmlns=\"\">" . $this->_prop_encode(htmlspecialchars($prop['val'])) . "</{$prop['name']}>\n";
                         }
                     }
                 }
             }
             echo "   </D:prop>\n";
             echo "   <D:status>HTTP/1.1 200 OK</D:status>\n";
             echo "  </D:propstat>\n";
         }
         // now report all properties requested bot not found
         if (isset($file["noprops"])) {
             echo "   <D:propstat>\n";
             echo "    <D:prop>\n";
             foreach ($file["noprops"] as $key => $prop) {
                 if ($prop["ns"] == "DAV:") {
                     echo "     <D:{$prop['name']}/>\n";
                 } else {
                     if ($prop["ns"] == "") {
                         echo "     <{$prop['name']} xmlns=\"\"/>\n";
                     } else {
                         echo "     <" . $ns_hash[$prop["ns"]] . ":{$prop['name']}/>\n";
                     }
                 }
             }
             echo "   </D:prop>\n";
             echo "   <D:status>HTTP/1.1 404 Not Found</D:status>\n";
             echo "  </D:propstat>\n";
         }
         echo " </D:response>\n";
     }
     echo "</D:multistatus>\n";
 }
開發者ID:jglaine,項目名稱:sugar761-ent,代碼行數:101,代碼來源:Server.php


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