本文整理汇总了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";
}