JSON code为我的广播电台的网站? [英] JSON code for my radio station website?
问题描述
这是我的电台网站的PHP代码的一部分:
http://pastebin.com/D1TUMNSc
This is part of my radio station website's PHP coding: http://pastebin.com/D1TUMNSc
我已经得到了PHP工作;但得到JSON工作是一个问题,我不知道如何与我有变量做...
I've got the PHP to work; but getting the JSON to work is a problem, I'm not sure how to do it with the variables I've got...
目前进度页面显示为空白,因为我不知道该怎么做。
Currently the schedule page shows as blank, since I'm not sure what to do.
JavaScript的是在这里: http://pastebin.com/P1ydnVCK
The Javascript is here: http://pastebin.com/P1ydnVCK
基本上,我遇到了麻烦试图创建一个JSON以适合的Javascript的变量范围内,这是新的给我,这种编程领域...
Basically, I'm having trouble trying to create a JSON to fit within the variables of the Javascript, it's new to me, this area of programming...
您有什么建议?
我已经围绕在净JSON资源的外观,但我不太知道该怎么为这一个呢!
I've had a look around the net at JSON resources but am not quite sure what to do for this one!
推荐答案
只是一个快速的样子所以这可能不是你所需要的一切,但......你需要做这样的事情....
Just a quick look so this may not be everything you need, but.... You need to do something like this....
$json->schedule = array();
// Loop Here
$show = array(
'longname' => 'xxxxx',
'description' => 'xxxxxx',
'weblink' => 'http://xxxx.com',
'showimage' => 'xxxx',
'startminutes' => '0000000',
'endminutes' => '000000',
);
// End Loop
$json->schedule[] = $show;
echo json_encode($json);
在与_s pfixed你的JavaScript什么$ P $需要一个变量...例如:this._s.longname
In your javascript anything prefixed with _s needs to be a variable... Ex: this._s.longname
这篇关于JSON code为我的广播电台的网站?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!