Home > php教程 > php手册 > body text

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

WBOY
Release: 2016-06-06 19:49:44
Original
1166 people have browsed it

---------------------------------------------------------------------------------------------- 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

@黑眼诗人 

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!