Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/joomla/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
编辑从PHP5.2到PHP5.3版本的错误_Php_Joomla_Joomla2.5_Joomla1.5 - Fatal编程技术网

编辑从PHP5.2到PHP5.3版本的错误

编辑从PHP5.2到PHP5.3版本的错误,php,joomla,joomla2.5,joomla1.5,Php,Joomla,Joomla2.5,Joomla1.5,我的主机将php版本从5.2更新到5.3(无法返回到5.2版本) 我的网站上只有一个警告错误,那就是:-> Warning: number_format() expects parameter 2 to be long, string given in /currency.php on line 77 以下是文件的代码: <?php defined('_JEXEC') or die('Restricted access'); class GCurrency { var $_symbol=

我的主机将php版本从5.2更新到5.3(无法返回到5.2版本) 我的网站上只有一个警告错误,那就是:->

Warning: number_format() expects parameter 2 to be long, string given in /currency.php on line 77
以下是文件的代码:

<?php
defined('_JEXEC') or die('Restricted access');
class GCurrency
{
var $_symbol=null;
var $_value=null;
var $_currency=null;
var $_decimal_separator=null;
var $_decimals=null;
var $_val_separator=null;
var $_format=null;
function __construct($val=0,$symbol='$',$currency='USD',$format="%S %V %C",$decimal="2",$dec=".",$v=",")
{
    $this->_symbol=empty($symbol)?'$':$symbol;
    $this->_currency=empty($currency)?"USD":$currency;
    $this->_value=$val;
    $this->_decimal_separator=empty($dec)?".":$dec;
    $this->_decimals=empty($decimal)?"2":$decimal;
    $this->_val_separator=empty($val)?",":$v;
    $this->_format=empty($format)?"%S %V %C":$format;
}
function setCurrencySymbol($symbol='$')
{
    $this->_symbol=$symbol;
}
function setDecimals($dec="2")
{
    $this->_decimals=$dec;
}
function setCurrency($currency="USD")
{
    $this->_currency=$currency;
}
function setValue($val=0,$symbol='$',$currency='USD')
{
    $this->_symbol=empty($symbol)?'$':$symbol;
    $this->_currency=empty($currency)?"USD":$currency;
    $this->_value=$val;
}
function setDecimalSeparator($dec=".")
{
    $this->_decimal_separator=$dec;
}
function setValueSeparator($val=",")
{
    $this->_val_separator=$val;
}
function setFormat($format="%S %V %C")
{
    $this->_format=$format;
}
function set($val=0,$symbol='$',$currency='USD',$format="%S %V %C",$decimal="2",$dec=".",$v=",")
{
    $this->_symbol=empty($symbol)?'$':$symbol;
    $this->_currency=empty($currency)?"USD":$currency;
    $this->_value=$val;
    $this->_decimal_separator=empty($dec)?".":$dec;
    $this->_decimals=empty($decimal)?"2":$decimal;
    $this->_val_separator=empty($val)?",":$v;
    $this->_format=empty($format)?"%S %V %C":$format;
}
function setParameters($format="%S %V %C",$decimal="2",$dec=".",$v=",")
{
    $this->_decimal_separator=empty($dec)?".":$dec;
    $this->_decimals=empty($decimal)?"2":$decimal;
    $this->_val_separator=empty($val)?",":$v;
    $this->_format=empty($format)?"%S %V %C":$format;
}
function toString()
{
    $pattern=array();
    $pattern[]='/%S/i';
    $pattern[]='/%V/i';
    $pattern[]='/%C/i';
    $value=array();
    /*$value[]=$this->_symbol;*/
    $value[]=number_format($this->_value,$this->_decimals,$this->_decimal_separator,$this->_val_separator);
    $value[]=$this->_currency;      
    return preg_replace($pattern,$value,$this->_format);
}
}
?>


有人能告诉我如何解决这个问题吗?

$this->\u小数点是一个数字,而不是一个字符串。因此,将其转换为整数,警告就会消失


使
$this->\u小数
成为一个数字而不是字符串。因此,将其转换为整数,警告就会消失


正如错误所说,它需要很长时间。无论如何,我怀疑PHP正在转换为long,但是在所有三元语句中,您都将$this_decimals设置为字符串,请注意,您将值包装在其中的双引号中。。例如“2”。

正如错误所说,它需要很长时间。无论如何,我怀疑PHP正在转换为long,但是在所有三元语句中,您都将$this_decimals设置为字符串,请注意,您将值包装在其中的双引号中。。例如“2”。

错误消息似乎不言自明。不要将字符串传递给
number\u格式
,而是传递一个数字。错误消息似乎不言自明。不要将字符串传递到
number\u格式
,传递一个数字。非常感谢您的帮助,我用“Schleis”编写的链接解决了这个问题。谢谢你非常感谢你的帮助,我用“Schleis”写的链接修复了这个问题。非常感谢。