为什么我得到"只有变量应该通过引用传递"在这种情况下?

时间:2015-08-24 18:14:56

标签: php mysql json reference

我的功能是

// helper function for removing escaped characters 
// from VARCHAR columns before converting table to JSON
function removeEscapes ( &$table )
{
    http://stackoverflow.com/questions/12026609/wordpress-how-to-unescape-the-results-when-using-wpdb-get-results
    foreach( $table as &$thisrow)
        foreach( $thisrow as &$thiscol)  
            if ( is_string( $thiscol) )  $thiscol= stripslashes( $thiscol );
}

我称之为

<?php
ini_set('display_errors', 'On');
error_reporting(-1);
global $wpdb;
$wholeTeam = removeEscapes($wpdb->get_results("SELECT id,name,title,bio,picurl FROM mems"));
?>

<script type="text/javascript">
    var team = <?php echo json_encode($wholeTeam); ?>;
</script>

为什么我

  

严格标准:只应通过引用传递变量

作为警告/错误?

0 个答案:

没有答案