Home  >  Article  >  Backend Development  >  i=127,怎么输出001 002 003 004 005 006 007047~127

i=127,怎么输出001 002 003 004 005 006 007047~127

WBOY
WBOYOriginal
2016-06-20 12:34:081137browse

总位数3位,不足前面补零

输出格式要拼接

xxx/$i.html|||xxx/$i.html|||xxx/$i.html|||xxx/$i.html|||xxx/$i.html|||xxx/$i.html|||xxx/$i.html|||xxx/$i.html|||xxx/$i.html|||xxx/$i.html|||xxx/$i.html|||xxx/$i.html|||xxx/$i.html|||xxx/$i.html|||xxx/$i.html|||xxx/$i.html

每个用|||隔开


回复讨论(解决方案)

for($i=1; $i<128; $i++) $r[] = sprintf('xxx/%03d.html', $i);echo join('|||', $r);
xxx/001.html|||xxx/002.html|||xxx/003.html|||xxx/004.html|||xxx/005.html|||xxx/006.html|||xxx/007.html|||xxx/008.html|||xxx/009.html|||xxx/010.html|||xxx/011.html|||xxx/012.html|||xxx/013.html|||xxx/014.html|||xxx/015.html|||xxx/016.html|||xxx/017.html|||xxx/018.html|||xxx/019.html|||xxx/020.html|||xxx/021.html|||xxx/022.html|||xxx/023.html|||xxx/024.html|||xxx/025.html|||xxx/026.html|||xxx/027.html|||xxx/028.html|||xxx/029.html|||xxx/030.html|||xxx/031.html|||xxx/032.html|||xxx/033.html|||xxx/034.html|||xxx/035.html|||xxx/036.html|||xxx/037.html|||xxx/038.html|||xxx/039.html|||xxx/040.html|||xxx/041.html|||xxx/042.html|||xxx/043.html|||xxx/044.html|||xxx/045.html|||xxx/046.html|||xxx/047.html|||xxx/048.html|||xxx/049.html|||xxx/050.html|||xxx/051.html|||xxx/052.html|||xxx/053.html|||xxx/054.html|||xxx/055.html|||xxx/056.html|||xxx/057.html|||xxx/058.html|||xxx/059.html|||xxx/060.html|||xxx/061.html|||xxx/062.html|||xxx/063.html|||xxx/064.html|||xxx/065.html|||xxx/066.html|||xxx/067.html|||xxx/068.html|||xxx/069.html|||xxx/070.html|||xxx/071.html|||xxx/072.html|||xxx/073.html|||xxx/074.html|||xxx/075.html|||xxx/076.html|||xxx/077.html|||xxx/078.html|||xxx/079.html|||xxx/080.html|||xxx/081.html|||xxx/082.html|||xxx/083.html|||xxx/084.html|||xxx/085.html|||xxx/086.html|||xxx/087.html|||xxx/088.html|||xxx/089.html|||xxx/090.html|||xxx/091.html|||xxx/092.html|||xxx/093.html|||xxx/094.html|||xxx/095.html|||xxx/096.html|||xxx/097.html|||xxx/098.html|||xxx/099.html|||xxx/100.html|||xxx/101.html|||xxx/102.html|||xxx/103.html|||xxx/104.html|||xxx/105.html|||xxx/106.html|||xxx/107.html|||xxx/108.html|||xxx/109.html|||xxx/110.html|||xxx/111.html|||xxx/112.html|||xxx/113.html|||xxx/114.html|||xxx/115.html|||xxx/116.html|||xxx/117.html|||xxx/118.html|||xxx/119.html|||xxx/120.html|||xxx/121.html|||xxx/122.html|||xxx/123.html|||xxx/124.html|||xxx/125.html|||xxx/126.html|||xxx/127.html

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