本文整理汇总了PHP中get_json函数的典型用法代码示例。如果您正苦于以下问题:PHP get_json函数的具体用法?PHP get_json怎么用?PHP get_json使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_json函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_commit
function get_commit($type)
{
return json_decode(get_json("repos/BlueVM/Neon/commits/{$type}"), true);
}
示例2: lms_list_course
function lms_list_course()
{
global $apiurl;
$response = get_json($apiurl . "/accounts/1/courses");
//print_r($response);
return $response;
}
示例3: login
function login($as_guest = '')
{
# code...
$this->load->library('guest');
$this->_go_to_dashboard();
$this->username_email = $this->input->post('username_email');
$this->password = $this->input->post('password');
if ($as_guest == 'as_guest') {
$this->username_email = 'guest';
$this->password = 'guest';
}
if ($this->login->login($this->username_email, $this->password)) {
if ($this->input->post('ajax')) {
$data['json'] = get_json('good_username_email_or_password');
$this->load->view('json', $data);
} else {
redirect('books');
}
} else {
if ($this->input->post('ajax')) {
$data['json'] = get_json('error_username_email_or_password');
$this->load->view('json', $data);
} else {
$this->index('error_username_email_or_password');
}
}
}
示例4: json_encode
function json_encode($var, $loose = FALSE)
{
$json = get_json();
if ($loose) {
$json->use = SERVICES_JSON_LOOSE_TYPE;
} else {
$json->use = 0;
}
return $json->encode($var);
}
示例5: display_works
function display_works($file_loc)
{
$file_list = glob($file_loc . '/*.json');
rsort($file_list);
$current_year = "";
foreach ($file_list as $file) {
$work = get_json($file);
if ($work) {
// skip if error, won't break page
$file_date = basename($file, '.json');
// get filename without extension
$file_date = substr($file_date, 0, 4);
// keep date
if ($file_date != $current_year) {
echo '<div class="row piece">';
} else {
echo '<div class="row piece sameyear">';
}
echo '<div class="1u 2u(3)">' . $file_date . '</div>';
echo '<div class="3u 5u(3) title">' . $work['title'] . '</div>';
echo '<div class="3u 5u(3)">' . $work['instrumentation']['short'] . '</div>';
// '<span id="full-inst" style="display: initial; min-height:0;">' . $work['instrumentation']['long'] . '</span>';
echo '<div class="2u not-small">';
if ($work['duration']['minutes']) {
echo $work['duration']['minutes'] . '′';
}
if ($work['duration']['seconds']) {
echo $work['duration']['seconds'] . '″';
}
echo '​';
echo '</div>';
echo '<div class="1u not-small comp-link">';
if ($work['links']['audio']) {
echo '<a href="' . $work['links']['audio'] . '"><i class="fa fa-volume-up"></i></a>';
}
echo '</div>';
echo '<div class="1u not-small comp-link">';
if ($work['links']['video']) {
echo '<a href="' . $work['links']['video'] . '"><i class="fa fa-youtube-play"></i></a>';
}
echo '</div>';
// echo '<div class="1u 2u(3) not-small">' ;
// if($work['links']['score']){echo '<a href="' . $work['links']['score'] . '">score</a>';}
// echo '</div>';
// echo '<div class="1u 2u(3) not-small">' .
// '<a href="#">listen</a>' .
// '</div>';
echo '</div>';
$current_year = $file_date;
}
}
}
示例6: update_profile
/**
* 更新用户信息
*/
function update_profile()
{
$userId = $_SESSION['userId'];
$oldPassword = is_empty($_REQUEST['oldPassword']) ? null : $_REQUEST['oldPassword'];
$password = is_empty($_REQUEST['password']) ? null : $_REQUEST['password'];
$password2 = is_empty($_REQUEST['password2']) ? null : $_REQUEST['password2'];
$code = '0';
if ($_SESSION['userDetail']['user_password'] != md5($oldPassword)) {
$code = 'wrongOldPassword';
} else {
$userService = new UserService();
$userService->updatePassword($userId, md5($password));
}
$output = array('retCode' => $code);
echo get_json($output);
}
示例7: fill_content
function fill_content()
{
$json = get_json();
$gallery = [];
$newwork = [];
foreach ($json->pieces as $piece) {
$new = $piece->new;
if ($new) {
array_push($newwork, $piece);
} else {
array_push($gallery, $piece);
}
}
//add functions for new and gallery
fill_new($newwork);
fill_gallery($gallery);
}
示例8: get_conversation
/**
* function get_conversation()
* This function gets the conversation format
* @param array $convoArr - the conversation array
* @return array $convoArr
**/
function get_conversation($convoArr)
{
$conversation = get_conversation_to_display($convoArr);
runDebug(__FILE__, __FUNCTION__, __LINE__, "Processing conversation as " . $convoArr['conversation']['format'], 4);
switch ($convoArr['conversation']['format']) {
case "html":
$convoArr = get_html($convoArr, $conversation);
break;
case "json":
$convoArr = get_json($convoArr, $conversation);
break;
case "xml":
$convoArr = get_xml($convoArr, $conversation);
break;
}
return $convoArr;
}
示例9: display_home
function display_home($file_list)
{
// $current_year = "";
foreach ($file_list as $file) {
$perf = get_json($file);
if ($perf) {
// skip if error, won't break page
$end = $perf['endDate'];
list($date, $date_year) = extract_date($file, $end);
// if ($date_year != $current_year) { echo "<h3>" . $date_year . "</h3>"; }
// $current_year = $date_year;
// if($display == 'full') {
home_json_perf($date, $perf);
//}
// elseif($display == 'short') {
// short_json_perf($date, $perf); }
}
}
}
示例10: moveRole
/**
* Reorder roles
*
* @return string json encoded object
*/
public function moveRole()
{
if ($this->input) {
$roles = get_json('items');
foreach ($roles as $key => $role_arr) {
$role = $this->model->find($role_arr['id']);
if (!\Access::isSystemRole($role->name)) {
if (array_key_exists($key - 1, $roles)) {
$prev_role = $this->model->find($roles[$key - 1]['id']);
$role->level = $prev_role->level - 1;
if ($role->level <= 0) {
$role->level = 0;
}
$role->save();
$this->events->fire('role.move', array($role));
}
}
}
return $this->setSuccess('alert.success.order_saved');
}
}
示例11: WeaveStorage
}
} else {
if ($_SERVER['REQUEST_METHOD'] == 'PUT') {
if (ENABLE_REGISTER) {
$db = new WeaveStorage(null);
//Requests that an account be created for username.
/*
The JSON payload should include
Field Description
password The password to be associated with the account.
email Email address associated with the account
captcha-challenge The challenge string from the captcha (see miscellaneous functions below)
captcha-response The response to the captcha. Only required if WEAVE_REGISTER_USE_CAPTCHA is set
*/
log_error("PUT");
$data = get_json();
log_error(print_r($data, true));
//werte vorhanden
if ($data == NULL) {
report_problem(WEAVE_ERROR_JSON_PARSE, 400);
}
$name = $username;
$pwd = fix_utf8_encoding($data['password']);
$email = $data['email'];
if ($email == '') {
log_error('create user datenfehler');
report_problem(WEAVE_ERROR_NO_EMAIL, 400);
} else {
if ($pwd == '') {
log_error('create user datenfehler');
report_problem(WEAVE_ERROR_MISSING_PASSWORD, 400);
示例12: get_json
text-align: center;
}
</style>
</head>
<body>
<div class="iets">
<?php
function get_json($filename)
{
// return - stuurt de nieuwe waarde van de functie terug.
// json_decode(x, true) - Zet de String x om in een JSON-array of -hash.
// file_get_contents(x) - Lees het bestand x en geef de inhoud.
return json_decode(file_get_contents($filename), true);
}
//later in je php bestand kun je deze functie oproepen
$json = get_json('voorbeeld.json');
//roept de functie op met je filename als parameter
//de data van je json betand zit nu in de variabele json
//haalt de array uit het .json bestand en stopt het in het variabele teksten
$teksten = $json['teksten'];
//stopt de informatie over de eerste tekst in een variabele en de andere in een ander variabele
$tekst1 = $teksten[0];
$tekst2 = $teksten[1];
// ### Tekst 1 ### //
//output de tekst en de titel
echo "<h1>" . $tekst1['titel'] . "</h1>";
echo "<p>" . $tekst1['tekst'] . "</p>";
// ### Tekst 2 ### //
//output de tekst en de titel
echo "<h1>" . $tekst2['titel'] . "</h1>";
echo "<p>" . $tekst2['tekst'] . "</p>";
示例13: get_thumbnail
function get_thumbnail($url)
{
$this->load->library('upload');
$url_original = $url;
if (parse_url($url)) {
$url = $this->addhttp($url);
$url = parse_url($url);
switch ($url['host']) {
case 'www.youtube.com':
parse_str($url['query'], $data);
$video = $data['v'];
$video_data = get_json("https://www.googleapis.com/youtube/v3/videos?id={$video}&part=snippet&key=AIzaSyBRa_48GW6LpDcB8VlQxrt5alf-4-GTThQ");
$thumbnail = $video_data->items[0]->snippet->thumbnails->high->url;
break;
case 'youtu.be':
$video = str_replace('/', '', $url['path']);
$json = get_json("https://www.googleapis.com/youtube/v3/videos?id={$video}&part=snippet&key=AIzaSyBRa_48GW6LpDcB8VlQxrt5alf-4-GTThQ");
$video_data = json_decode($json);
$thumbnail = $video_data->items[0]->snippet->thumbnails->high->url;
break;
case 'www.dailymotion.com':
$path = explode('/', $url['path']);
$video = $path[2];
$thumbnail = "http://www.dailymotion.com/thumbnail/video/{$video}";
break;
case 'vimeo.com':
$path = explode('/', $url['path']);
$video = end($path);
$hash = unserialize(file_get_contents("http://vimeo.com/api/v2/video/{$video}.php"));
$thumbnail = $hash[0]['thumbnail_large'];
break;
case 'www.mmpro.de':
$this->load->library('simple_html_dom');
$html = file_get_html($url_original);
foreach ($html->find('link[rel=canonical]') as $element) {
$canonical_url = $element->href;
}
$canonical_url = $this->addhttp($canonical_url);
$canonical_url = parse_url($canonical_url);
parse_str($canonical_url['query'], $data);
$video_id = $data['videoId'];
$json_output = get_json("http://www.mmpro.de/cache/videolist.json", true);
foreach ($json_output as $object) {
foreach ($object as $video) {
$video_to_display = $video;
foreach ($video["video"] as $video_data) {
$video_uri = $video_data['uri'];
if ($video_data['uri'] == $video_id) {
break 3;
}
}
}
}
if (isset($video_to_display['mcf'])) {
$thumbnail = "http://www.mcfootage.com/imagereplace.php?width=900&height=600&kunde=archive&file=" . $video_to_display['picture'];
} else {
$json_output = get_json("http://www.admiralcloud.com/player/json/" . $video_uri);
$thumbnail = $json_output->movies[0]->jpg;
}
break;
case 'www.tvbvideo.de':
$CI =& get_instance();
$CI->load->library('simple_html_dom');
$html = file_get_html($url_original);
$r = html_entity_decode($html->find('#export_website_code', 0)->innertext());
$r_html = str_get_html($r);
preg_match('(http://api.kewego.com/video/getHTML5Thumbnail.+\\"\\))', $r_html, $thumbnail);
$thumbnail = substr($thumbnail[0], 0, -2);
$thumbnail = $this->get_final_url($thumbnail);
break;
default:
echo "Je ne connais pas ce site web... Veuillez vérifier le lien.";
break;
}
if (isset($thumbnail) && $thumbnail != "assets/img/nopic.jpg") {
//UPLOAD THUMBNAILS
$filename = 'import_' . slug($_POST['title']) . '.jpg';
grab_image($thumbnail, $this->photos_path . $filename);
$data['filename'] = $filename;
if (autoCrop($data)) {
create_thumbnail($data);
create_header($data);
unlink($this->photos_path . $filename);
}
return $filename;
} else {
if ($thumbnail == "assets/img/nopic.jpg") {
return "nopic.jpg";
} else {
return false;
}
}
} else {
return false;
}
}
示例14: debugger
$count = 1;
if ($key == 'report') {
debugger("Value : " . print_r($value, TRUE));
debugger("Got report URL : " . $value['@reportUri']);
echo "NOTE: " . date("Y-m-d H:i:s") . ": Got report to process for {$start_date} to {$end_date}. Waiting...\n";
sleep(300);
$report = get_json($value['@reportUri']);
$count = 1;
$rc = FALSE;
while ($rc == FALSE) {
while ($report['@reportReady'] == "false" && $count <= 100) {
//Wait 60 seconds
debugger("Report Not Ready : Waiting 5 mins. Count is {$count}.");
echo "NOTE: " . date("Y-m-d H:i:s") . ": Report Not Ready for {$start_date} to {$end_date}. Waiting 5 mins... Count is : {$count}.\n";
sleep(300);
$report = get_json($value['@reportUri']);
$count++;
}
$file = get_file($value['@reportUri'], $report_file);
echo "NOTE: " . date("Y-m-d H:i:s") . ": File {$file} parsing started for {$start_date} to {$end_date}.\n";
if (!array_key_exists('x', $options)) {
$fhs = fopen($output_file_sessions, 'w') or die("ERROR: Could not open session output file.\n");
$fhe = fopen($output_file_events, 'w') or die("ERROR: Could not open events output file.\n");
$rc = parse_file($file, $row['game_id'], $row['device_id'], $options);
fclose($fhs);
fclose($fhe);
echo "NOTE: " . date("Y-m-d H:i:s") . ": File {$file} parsing complete for {$start_date} to {$end_date}.\n";
} else {
echo "NOTE: " . date("Y-m-d H:i:s") . ": File {$file} was not parsed for {$start_date} to {$end_date}.\n";
$rc = TRUE;
}
示例15: get_status
function get_status()
{
return get_json("STATUS\n");
}