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