相关疑难解决方法(0)

能够在print_r()的输出中看到变量,但不知道如何在代码中访问它

我用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 drupal drupal-7

15
推荐指数
2
解决办法
4029
查看次数

PHP json_decode无法正常工作

我试图使用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)

php json

4
推荐指数
1
解决办法
2万
查看次数

标签 统计

php ×2

drupal ×1

drupal-7 ×1

json ×1