本文整理汇总了PHP中get_json函数的典型用法代码示例。如果您正苦于以下问题:PHP get_json函数的具体用法?PHP get_json怎么用?PHP get_json使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_json函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: get_commit
function get_commit($type)
{
return json_decode(get_json("repos/BlueVM/Neon/commits/{$type}"), true);
}
开发者ID:deanet,项目名称:Neon,代码行数:4,代码来源:update.php
示例2: lms_list_course
function lms_list_course()
{
global $apiurl;
$response = get_json($apiurl . "/accounts/1/courses");
//print_r($response);
return $response;
}
开发者ID:par-orillonsoft,项目名称:elearning-wordpress,代码行数:7,代码来源:canvas.php
示例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');
}
}
}
开发者ID:eriksulymosi,项目名称:ektf_konyvtar,代码行数:27,代码来源:user.php
示例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);
}
开发者ID:radicaldesigns,项目名称:amp,代码行数:10,代码来源:JSON_Compat.php
示例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;
}
}
}
开发者ID:johnteske,项目名称:johnteskemusic.com,代码行数:52,代码来源:index.php
示例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);
}
开发者ID:sjimkros,项目名称:myweb,代码行数:19,代码来源:user_action.php
示例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);
}
开发者ID:eahenke,项目名称:henkestencils,代码行数:17,代码来源:index.php
示例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;
}
开发者ID:massyao,项目名称:chatbot,代码行数:23,代码来源:display_conversation.php
示例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); }
}
}
}
开发者ID:johnteske,项目名称:johnteskemusic.com,代码行数:19,代码来源:index.php
示例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');
}
}
开发者ID:pongocms,项目名称:cms,代码行数:26,代码来源:RoleManager.php
示例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);
开发者ID:dipolukarov,项目名称:FSyncMS,代码行数:31,代码来源:user.php
示例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>";
开发者ID:C-Bouthoorn,项目名称:Martens-Code,代码行数:31,代码来源:voorbeeld.php
示例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;
}
}
开发者ID:patataweb,项目名称:severine,代码行数:96,代码来源:video.php
示例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;
}
开发者ID:rjevansatari,项目名称:Analytics,代码行数:31,代码来源:poll_flurry4.php
示例15: get_status
function get_status()
{
return get_json("STATUS\n");
}
开发者ID:rslitchfield,项目名称:stratux,代码行数:4,代码来源:control.php
示例16: getEmissions
function getEmissions($date)
{
$podcasts = get_json($date->format("Y-m-d"));
if (!isset($podcasts) || count($podcasts->track) == 0) {
return $podcasts;
}
foreach ($podcasts->track as $key => $podcast) {
if (strlen($podcast->mp3) == 0) {
unset($podcasts->track[$key]);
}
}
return $podcasts;
}
开发者ID:RadioCampusFrance,项目名称:podcast-rccf,代码行数:13,代码来源:search.php
示例17: curl_close
curl_close($curl);
return $content;
}
$github_latest = json_decode(get_json('https://api.github.com/repos/kyufox/manga/releases/latest'), true);
$current_version = 'none';
if (isset($github_latest['tag_name'])) {
$latest_version = $github_latest['tag_name'];
} else {
$latest_version = 'none';
}
if ($latest_version != 'none' && $latest_version > $current_version) {
$new_version = true;
} else {
$new_version = false;
}
$github_commit = json_decode(get_json('https://api.github.com/repos/kyufox/manga/commits'), true);
?>
<div class="row">
<div class="box col-12">
<div class="breadcrumbs">
<ol>
<li><a href="admin">Admin Panel</a></li>
<li class="active">Version Info</li>
</ol>
</div>
</div>
<?php
if ($new_version == true) {
?>
开发者ID:pwltt,项目名称:MES-PWLTT-ENVI,代码行数:31,代码来源:admin.php
示例18: get_json
<?php
include 'nav.php';
//includes the navigation bar; for easy modifications
?>
<?php
// ### Gekopieerd uit template ### //
//Functie om de data uit je .json te halen
//Parameter van je fucnite is de naam van je .json bestand
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('links.json');
//roept de functie op met je filename als parameter
//de data van je json betand zit nu in de variabele json
$paginas = $json['paginas'];
$link1 = $paginas[0];
$link2 = $paginas[1];
echo $link2['link'];
?>
</body>
</html>
开发者ID:C-Bouthoorn,项目名称:Martens-Code,代码行数:29,代码来源:links.php
示例19: get_json
function get_json($url)
{
$base = "https://api.github.com/";
$curl = curl_init();
curl_setopt($curl, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.13) Gecko/20080311 Firefox/2.0.0.13');
curl_setopt($curl, CURLOPT_URL, $base . $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
$content = curl_exec($curl);
curl_close($curl);
return $content;
}
$feed = "repos/processing/processing/commits";
$cache_file = dirname(__FILE__) . '/cache/' . 'github-cache';
$modified = filemtime($cache_file);
$now = time();
$interval = 600;
// ten minutes
if (!$modified || $now - $modified > $interval) {
$json = get_json($feed);
if ($json) {
$cache_static = fopen($cache_file, 'w');
fwrite($cache_static, $json);
fclose($cache_static);
}
}
header('Cache-Control: no-cache, must-revalidate');
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Content-type: application/json');
$json = file_get_contents($cache_file);
echo $json;
开发者ID:parsoyaarihant,项目名称:processing-docs,代码行数:31,代码来源:github.php
示例20: toPaulo
function toPaulo()
{
$resultat = array();
$date = $_GET['d'];
$time = "" . $_GET['t'];
if (strlen($time) == 1) {
$time = "0" . $_GET['t'];
}
$jsonDay = get_json($date);
if (!$jsonDay) {
$resultat["error"] = "Impossible de trouver l'entrée correspondante";
}
$jsonNewDay->track = array();
if ($jsonDay->track) {
foreach ($jsonDay->track as $track) {
if (intval($track->time) != intval($time)) {
$jsonNewDay->track[] = $track;
}
}
}
$fileOK = get_filename($date, $time, true);
$fileKO = get_filename($date, $time, false);
if (file_exists($fileOK)) {
$valid = @rename($fileOK, $fileKO);
if (!$valid) {
$resultat["error"] = "Impossible de deplacer le fichier";
return $resultat;
}
}
save_json($date, $jsonNewDay);
$resultat["action"] = "2paulo";
return $resultat;
}
开发者ID:RadioCampusFrance,项目名称:podcast-rccf,代码行数:33,代码来源:index.php
注:本文中的get_json函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论