我用Google搜索,安装了Devel,Drupal for Firebug,但我找不到它.
我发现了我想要的东西,我知道它在哪里 ; 我只是不知道如何得到它.
我将它放在代码括号中,但是Devel告诉我文件名(我想要粘贴到.tpl.php文件中)在这里:
field_image (Object) stdClass
handler (Object) views_handler_field_field
view (Object) view
result (Array, 2 elements)
0 (Object) stdClass
_field_data (Array, 1 element)
nid (Array, 2 elements)
entity (Object) stdClass
field_image (Array, 1 element)
und (Array, 1 element)
0 (Array, 11 elements)
filename (String, 23 characters ) FILENAME.jpg
那么,我如何使用PHP输出FILENAME.jpg?
<?php print $something->other; ?>
Run Code Online (Sandbox Code Playgroud) 我试图使用PHP的json_decode函数从json对象获取特定值.示例代码如下:
foreach ($streams as &$i) {
$chan = "http://api.justin.tv/api/stream/list.json?channel=" . $i;
$json = file_get_contents($chan); //Turns the gathered file information into a string for searching purposes.
echo $json . " End of json variable.<br>";
$exist = strpos($json, 'name'); // Search the file/json object for the name attribute
if($exist) { // Check to see if a name existed and if so add it to the live streams and get the image.
echo " <a href=\"http://justin.tv/" . $i . "\">" . $i . …Run Code Online (Sandbox Code Playgroud)