当前位置: 首页>>代码示例>>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;未经允许,请勿转载。