本文整理汇总了PHP中Output::set_template方法的典型用法代码示例。如果您正苦于以下问题:PHP Output::set_template方法的具体用法?PHP Output::set_template怎么用?PHP Output::set_template使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Output
的用法示例。
在下文中一共展示了Output::set_template方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: header
header(':', true, $code);
}
}
if (!Session::is_user() && (substr(LINK_FILE, 0, 4) == "ajax" && LINK_FILE != "ajax/login.php")) {
http_response_code(403);
exit(json_encode(array("error" => "Your session has timed out, or you have logged out in another tab. Please log in again.")));
}
if (substr(LINK_FILE, 0, 6) == "studio") {
MainTemplate::set_barebones(true);
if (isset($_REQUEST["key"])) {
if (is_null(Locations::get_by_key($_REQUEST["key"]))) {
exit("Sorry, you provided an invalid security key.");
}
} else {
Output::require_user();
}
}
if (LINK_FILE != "index.php" && LINK_FILE != "ajax/login.php" && substr(LINK_FILE, 0, 6) != "studio" && substr(LINK_FILE, 0, 5) != "audio") {
Output::require_user();
}
if (Session::is_developer()) {
ini_set("display_errors", "1");
ini_set("display_startup_errors", "1");
ini_set("html_errors", "1");
ini_set("docref_root", "http://www.php.net/");
ini_set("error_prepend_string", "<div class=\"alert alert-error\">");
ini_set("error_append_string", "</div>");
}
if (substr(LINK_FILE, 0, 4) != "ajax") {
Output::set_template("MainTemplate");
}
示例2: json_encode
<?php
Output::set_template();
$query = $_REQUEST['q'];
if ($query) {
$search = Search::prerecords(str_replace(" ", " | ", $query), 5);
}
$tracks = $search["results"];
$tracks_array = array();
if ($tracks) {
foreach ($tracks as $track_id) {
$track_object = Tracks::get($track_id);
$track = array('id' => $track_object->get_id(), 'title' => $track_object->get_title(), 'by' => $track_object->get_artists_str(), 'href' => LINK_ABS . "music/detail/" . $track_object->get_id());
array_push($tracks_array, $track);
}
}
$array = array("title" => "Prerecords", "href" => LINK_ABS . "music/search/?i=title&q=" . $query, "data" => $tracks_array);
echo json_encode($array);