$chrw = $this->GetArrStringWidth($chars, '', '', 0, true);
array_walk($chrw, array($this, 'getRawCharWidth'));
$maxchwidth = max($chrw);报这样的错误 max() [function.max]: Array must contain at least one element
我在max函数之前输出$chrw 有内容,是array([1]=>6.35 [2]=>6.35 [3]=>6.35)
PHP
array_walk($chrw, array($this, 'getRawCharWidth'));
$maxchwidth = max($chrw);报这样的错误 max() [function.max]: Array must contain at least one element
我在max函数之前输出$chrw 有内容,是array([1]=>6.35 [2]=>6.35 [3]=>6.35)
PHP
这个数组我怎么看都感觉不对啊
阵列必须包含至少一种元素
max函数里肯定是可以放变量的,报错说明里面的数组有问题,array([1]=>6.35 [2]=>6.35 [3]=>6.35)
这个数组我怎么看都感觉不对啊不好意思,那是我手写的,是这样的
Array
(
[0] => 6.35
[1] => 6.35
[2] => 6.35
)
Array
(
[0] => 6.35
[1] => 6.35
[2] => 6.35
)
数组里面有元素啊
array(3) { [0]=> float(6.35) [1]=> float(6.35) [2]=> float(6.35) }
var_dump($chrw);
array_walk($chrw, array($this, 'getRawCharWidth'));
var_dump($chrw);
$maxchwidth = max($chrw);分别看一下
我按照您说的做了,分别看了下,但是输出的都是
array(3) { [0]=> float(6.35) [1]=> float(6.35) [2]=> float(6.35) }
array(3) { [0]=> float(6.35) [1]=> float(6.35) [2]=> float(6.35) } array(3) { [0]=> float(6.35) [1]=> float(6.35) [2]=> float(6.35) }
而且本地没错,服务器错你上面的var_dump是否都在本地测试啊?要在出错的服务器上测试啊
那你就要检查是否还有别的地方用了max(),说不准是其他地方报错
那你就要检查是否还有别的地方用了max(),说不准是其他地方报错max() [function.max]: Array must contain at least one elementError File: \includes\plugin\tcpdf\tcpdf.php at 6301 line.
>> report_issue
>> 返回上一页
那你就要检查是否还有别的地方用了max(),说不准是其他地方报错
指定行数了就说在这一行