Heim  >  Artikel  >  php教程  >  关于PHP Notice: A non well formed numeric value encountered,

关于PHP Notice: A non well formed numeric value encountered,

WBOY
WBOYOriginal
2016-06-06 19:49:441168Durchsuche

---------------------------------------------------------------------------------------------- A non well formed numeric value encountered= 从词面上来理解,可以大概窥探到一些意思:遇到了形成不是很好的数值 ; ok, 我们猜想可能是某个参数类型不

----------------------------------------------------------------------------------------------

A non well formed numeric value encountered=>

从词面上来理解,可以大概窥探到一些意思:遇到了形成不是很好的数值 ;

ok, 我们猜想可能是某个参数类型不对,需要传入数值型而实际可能是字符串。

 

那么,解决这个问题先去看你自定义的函数,传入的参数类型和实际使用的是否一致。

如:bool imagecopymerge ( resource $dst_im , resource $src_im , int $dst_x , int $dst_y , int$src_x , int $src_y , int $src_w , int $src_h , int $pct );

其中几个指定位置和宽高的参数都为int(整型),如果不小心传入带'px'单位的,那么报错了。

 

你可以有多种方法对数据进行处理后再传入,如:

$str = '1px';

echo intval($str);    //1

echo rtrim($str, 'px'); //1

 

Link: http://www.cnblogs.com/farwish/p/3791663.html

@黑眼诗人 

Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn