尝试在foreach循环中通过引用编辑数组值

时间:2022-10-25 09:11:46

I've got this code:

我有这个代码:

    foreach ($variables['results'] as $group => &$results) {

        if (isset($headers[$group])) {

            $results[0]0] = "<a href='".$results[0][0]. "' />". "Title" . "</a>";

            //drupal_set_message(print_r($results[0][0], true));


            $string .= theme('table', array('header' => array_values($headers[$group]), 'rows' => $results));
        }
    }

I am trying to modify the $results[0][0] to be a link instead.

我试图将$ results [0] [0]修改为链接。

My IDE is saying that I'm doing something incorrectly - what is it? What is the correct/preferred way to do this (specifically with Drupal, if possible, PHP best practices otherwise)

我的IDE说我做错了什么 - 它是什么?执行此操作的正确/首选方法是什么(特别是使用Drupal,如果可能,请使用PHP最佳实践)

1 个解决方案

#1


1  

Change:

更改:

$results[0]0]

to:

至:

$results[0][0]

#1


1  

Change:

更改:

$results[0]0]

to:

至:

$results[0][0]