注意:在php 7.0中只能通过引用分配变量

时间:2016-12-01 15:43:33

标签: php

我无法找到此通知的解决方案:

  

注意:只应在第15行的/xxxxx/www/administrator/modules/mod_hccmededelingen/tmpl/default.php中通过引用分配变量

<?php
        // No direct access
        defined('_JEXEC') or die;
        $componentnaam = 'com_hccxmlbeheer';
        $componentcat = 'com';
        // haal variable op
        jimport('HCCxmlLibrary.HCCxmlLibrary');
        jimport( 'joomla.plugin.helper' );
        // haal setting op ingestelde groepering op bij de Authenticatie plugin
        $authplugin = JPluginHelper::getPlugin('authentication', 'HCCxmlAuthenticatie');
        $authpluginparams               = new JRegistry($authplugin->params);
        $Ingesteldegroepering   = $authpluginparams->get('groepering', '');
        $config = JFactory::getConfig();
        $liveurl = $config->get('live_site');
        $user =& JFactory::getUser();
        $name = $user->name;
        $berichten = HCC::getberichten($componentnaam, $componentcat);
        $mededeling = $berichten['mededelingen'];
        $AlertActief = $berichten['AlertActief'];
        $Alert = $berichten['Alert'];

        if ($AlertActief == 1)
        {
                echo "
                <div class=\"alert alert-error\">
                <h4 class=\"alert-heading\">Opgelet!:</h4>
                <p>$Alert</p>
                </div>
                ";
        }
        $query = "SELECT `id` FROM `#__template_styles` WHERE `client_id` = 0 AND `home` = '1'";
        $styleId = HCC::selectwaarde($query, $componentnaam, $componentcat);
        echo "<div class=\"row-striped\">";
        echo "<br>";
        echo "Hallo $name,";
        echo "<br>";
        echo "<br>";
        echo "Om de \"template module locatie's\" te bekijken  <a href=\"$liveurl/index.php?tp=1&templateStyle=$styleId\" target=\"_blank\">klik hier</a><br><br>";

        echo "$mededeling";
        echo "</div>"; 

?>

注意:我不需要使用此方法在php.ini中禁用严格标准:

error_reporting = E_ALL & ~E_NOTICE & ~E_STRICT

我想修复我的PHP代码。

1 个答案:

答案 0 :(得分:1)

以下行会出现此错误:

$user =& JFactory::getUser();

您无法直接添加函数返回值的引用。你需要在变量之前将其强制转换并对其进行引用。 如果要修改私有属性,请使用对象的setMethod