Home > Backend Development > PHP Tutorial > 网上的一段代码错哪了

网上的一段代码错哪了

WBOY
Release: 2016-06-13 11:44:45
Original
838 people have browsed it

网上的一段代码哪里错了?

<?php <br />/**<br> * 电话号码识别.<br> * @author by zsc for 2010.03.24<br> */<br> <br>class gjPhone{<br>  protected $imgPath;//图片路径    <br>  protected $imgSize;//图片大小<br>  protected $hecData;//分离后数组<br>  protected $horData;//横向整理的数据<br>  protected $verData;//纵向整理的数据<br> <br>  function __construct($path){<br>      $this->imgPath = $path;<br>  }<br>/**<br> * 颜色分离转换...<br> *<br> * @param unknown_type $path<br> * @return unknown<br> */<br>  public function getHec()<br>    {   <br>        $size = getimagesize($this->imgPath);<br>        $res = imagecreatefrompng($this->imgPath);        <br>        for($i=0; $i         {   <br>            for($j=0; $j             {<br>                $rgb = imagecolorat($res,$j,$i);<br>                $rgbarray = imagecolorsforindex($res, $rgb);               <br>                if($rgbarray['red']                 || $rgbarray['blue']                 {<br>                    $data[$i][$j]=1;<br>                }else{<br>                    $data[$i][$j]=0;<br>                }<br>            }<br>        }<br>        $this->imgSize = $size;<br>        $this->hecData = $data;<br>    }<br>/**<br> * 颜色分离后的数据横向整理...<br> *<br> * @return unknown<br> */<br>public function magHorData()<br>{   <br> <br>    $data = $this->hecData;<br>    $size = $this->imgSize;    <br>    $z = 0;<br>    for($i=0; $i    { <br>        if(in_array('1',$data[$i])){<br>            $z++;<br>            for($j=0; $j            {   <br>                if($data[$i][$j] == '1'){                    <br>                   $newdata[$z][$j] = 1;<br>                }else{<br>                   $newdata[$z][$j] = 0; <br>                }<br>            }           <br>       }    <br> <br>    }<br>    return $this->horData = $newdata;<br>} <br>/**<br> * 整理纵向数据...<br> *<br> * @return unknown<br> */<br>public function magVerData($newdata){<br>    for ($i=0;$i        for($j=1;$j            $ndata[$i][$j] = $newdata[$j][$i];<br>        }<br>    }<br> <br> <br>    $sum = count($ndata);<br>    $c = 0;<br>    for ($a=0;$a        $value = $ndata[$a];<br>        if(in_array(1,$value)){            <div class="clear">
                 
              
              
        
            </div>
Copy after login
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 Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template