Home > php教程 > php手册 > 顺丰快递单号联想

顺丰快递单号联想

WBOY
Release: 2016-06-07 11:41:44
Original
2821 people have browsed it

给出1张单号,联想出之后的单号
PHP版本:<div class="code" style="position:relative; padding:0px; margin:0px;"><pre class="brush:php;toolbar:false">&lt;?php &lt;br /&gt;     print_r(sf(755000004593,20));&lt;br&gt;     function sf($code,$num){&lt;br&gt;         if(!is_numeric($code) || strlen($code)!=12) die ('起始值验证失败!不是有效的12位数字!');&lt;br&gt;         for($i=0;$i             if($i==0){&lt;br&gt;                 $start=(float)substr($code,0,11);&lt;br&gt;                 $n12=substr($code,11);&lt;br&gt;                 $arr[]=$a=(string)$code;&lt;br&gt;             }else{        &lt;br&gt;                 $n12=($a[10]==9?(($a[9]==3||$a[9]==6)?(($n12+5)%10):($a[9]==9?($a[8]%2?($a[8]==9?($a[7]%3?(($n12+9)%10):($a[7]==9?($a[6]==0?(($n12+7)%10):($a[6]==9?($a[5]==9?(($a[4]==3||$a[4]==6)?(($n12+8)%10):($a[4]==9?($a[3]%2?(($n12+4)%10):(($n12+5)%10)):(($n12+9)%10))):(($n12+3)%10)):(($n12+6)%10))):($n12%10))):(($n12+2)%10)):(($n12+3)%10)):(($n12+6)%10))):(($n12+9)%10));&lt;br&gt;                 $arr[]=$a=($start+$i).$n12;&lt;br&gt;             }&lt;br&gt;         }&lt;br&gt;         return $arr;&lt;br&gt;     }&lt;br&gt; ?&gt;</pre><div class="contentsignin">Copy after login</div></div>JavaScript版本:<script><br /> alert(sf(755000004593,20));<br /> function sf(code,num){<br /> var a,n12,arr = [];<br /> for(i=0;i<num;i++){<br /> if(i==0){<br /> arr.push(a=String(code));<br /> n12=a[11];<br /> start=parseFloat(a.substr(0,11));<br /> }else{ <br /> n12=(a[10]==9?((a[9]==3||a[9]==6)?((n12*1+5)%10):(a[9]==9?(a[8]%2?(a[8]==9?(a[7]%3?((n12*1+9)%10):(a[7]==9?(a[6]==0?((n12*1+7)%10):(a[6]==9?(a[5]==9?((a[4]==3||a[4]==6)?((n12*1+8)%10):(a[4]==9?(a[3]%2?((n12*1+4)%10):((n12*1+5)%10)):((n12*1+9)%10))):((n12*1+3)%10)):((n12*1+6)%10))):(n12%10))):((n12*1+2)%10)):((n12*1+3)%10)):((n12*1+6)%10))):((n12*1+9)%10));<br /> arr.push(a=(start+i)+String(n12));<br /> }<br /> }<br /> return arr;<br /> }<br /> </script>

AD:真正免费,域名+虚机+企业邮箱=0元

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