本文整理匯總了PHP中Utilities::convertToHMS方法的典型用法代碼示例。如果您正苦於以下問題:PHP Utilities::convertToHMS方法的具體用法?PHP Utilities::convertToHMS怎麽用?PHP Utilities::convertToHMS使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Utilities
的用法示例。
在下文中一共展示了Utilities::convertToHMS方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: getTime
public function getTime()
{
return Utilities::convertToHMS($this->getTimestamp());
}
示例2: getSearchResults
public function getSearchResults($query)
{
$search_results = array();
if (!empty($query)) {
$search_query = $this->_connection->prepare("SELECT `Episode`, `Timestamp`, `Value` FROM `timestamps` WHERE REPLACE(`Value`, :Replace, '') LIKE :Value");
$search_query->bindValue(":Replace", "'");
$search_query->bindValue(":Value", "%" . str_replace("'", "", trim($query) . "%"));
$search_query->execute();
foreach ($search_query->fetchAll() as $result) {
$timestamp_data = array();
$timestamp_data["Timestamp"] = $result["Timestamp"];
$timestamp_data["Value"] = $result["Value"];
$timestamp_data["HMS"] = Utilities::convertToHMS($result["Timestamp"]);
$search_results[$result["Episode"]][] = $timestamp_data;
}
} else {
$search_query = $this->_connection->prepare("SELECT * FROM `episodes`");
$search_query->execute();
foreach ($search_query->fetchAll() as $result) {
$search_results[] = $result["Identifier"];
}
}
return $search_results;
}
示例3: getRecentYouTubeVideos
public function getRecentYouTubeVideos()
{
if ($this->getYouTube() != "") {
$youtube_results = @file_get_contents("https://gdata.youtube.com/feeds/users/" . $this->getYouTube() . "/uploads?alt=json&max-results=6");
if ($youtube_results === false) {
return array();
} else {
$youtube_json = json_decode($youtube_results, true);
if (isset($youtube_json["feed"]["entry"])) {
$youtube_videos = array();
foreach ($youtube_json["feed"]["entry"] as $video_result) {
$youtube_video = array();
$youtube_video["Title"] = $video_result["title"]["\$t"];
$youtube_video["Link"] = $video_result["link"][0]["href"];
if (isset($video_result["gd\$comments"])) {
$youtube_video["Comments"] = $video_result["gd\$comments"]["gd\$feedLink"]["countHint"];
} else {
$youtube_video["Comments"] = "0";
}
$youtube_video["Thumbnail"] = $video_result["media\$group"]["media\$thumbnail"][0]["url"];
$youtube_video["Duration"] = Utilities::convertToHMS($video_result["media\$group"]["yt\$duration"]["seconds"]);
$youtube_videos[] = $youtube_video;
}
return $youtube_videos;
} else {
return array();
}
}
} else {
return array();
}
}