- <?php
- //第一种方法:
- $line = getrandline1('test.txt');
- function getrandline1($filename)
- {
- $linenum = 0;
- $fh = fopen($filename, 'r');
- while(!feof($fh))
- {
- if($rowcontents = fgets($fh))
- {
- $linenum++;
- $contens[] = $rowcontents;
- }
- }
- $randline = mt_rand(0, $linenum – 1);
- $line = $contens[$randline];
- fclose($fh);
- return $line;
- }
- //第二种方法:
- $line = getrandline2('test.txt');
- function getrandline2($filename)
- {
- $contents = file('test.txt');
- $linenum = count($contents);
- $randline = mt_rand(0, $linenum – 1);
- $line = $contents[$randline];
- return $line;
- }
- //第三种方法:
- $line = getrandline3('test.txt');
- function getrandline3($filename)
- {
- $contents = file('test.txt');
- shuffle($contents);
- return $contents[0];
- }
- //第四种方法:
- $line = getrandline4('test.txt');
- function getrandline4($filename)
- {
- $linenum = 0;
- $fh = fopen($filename, 'r');
- while(!feof($fh))
- {
- if($linecontents = fgets($fh))
- {
- $linenum++;
- $randint = (mt_rand(1, 1000000 * $linenum) – 1)/1000000);
- if($randint < 1)
- {
- $line = $linecontents;
- }
- }
- }
- fclose($fh);
- return $line;
- }
- ?>
波比源码 – 精品源码模版分享 | www.bobi11.com
1. 本站所有资源来源于用户上传和网络,如有侵权请邮件联系站长!
2. 分享目的仅供大家学习和交流,您必须在下载后24小时内删除!
3. 不得使用于非法商业用途,不得违反国家法律。否则后果自负!
4. 本站提供的源码、模板、插件等等其他资源,都不包含技术服务请大家谅解!
5. 如有链接无法下载、失效或广告,请联系管理员处理!
6. 本站资源售价只是赞助,收取费用仅维持本站的日常运营所需!
7. 本站源码并不保证全部能正常使用,仅供有技术基础的人学习研究,请谨慎下载
8. 如遇到加密压缩包,请使用WINRAR解压,如遇到无法解压的请联系管理员!
波比源码 » php 文件中随机取出一条数据
波比源码 » php 文件中随机取出一条数据
buy levofloxacin online levofloxacin buy online
buy spironolactone online cheap valtrex 1000mg us buy diflucan 200mg without prescription
order ampicillin pills order ampicillin 500mg online cheap purchase erythromycin generic
sildenafil 50mg cheap bimatoprost generic methocarbamol oral
purchase suhagra buy estradiol sale buy estrace 2mg sale
lamictal 50mg price prazosin 1mg cheap tretinoin gel usa
isotretinoin 10mg over the counter buy amoxil 1000mg generic purchase azithromycin online
buy indocin 50mg pill buy cefixime 100mg pill buy generic amoxicillin
cialis professional cialis 20mg lowest price overnight delivery for viagra
buy prednisone pills buy viagra 50mg for sale sildenafil 50mg for sale
purchase benicar pills order generic olmesartan diamox brand
order zyban 150mg online cheap order zyrtec for sale buy quetiapine 100mg
zoloft usa buy zoloft 100mg generic sildenafil citrate
buy salbutamol 100mcg for sale sildenafil pills cheap sildenafil pills
order tadalafil 10mg online cheap Cialis generic real viagra pills
cost cialis phenazopyridine 200mg generic order symmetrel 100 mg
cheap naltrexone 50mg buy generic revia aripiprazole 30mg generic
buy modafinil 100mg pills canadian pharmacy online coupon ivermectin 12mg without a doctor prescription
tadalafil 10mg us order tadalafil 20mg sale sildenafil order online
buy generic cialis 10mg anafranil cost anafranil over the counter
viagra ca buy sildenafil 100mg generic purchase lisinopril generic
buy omeprazole 20mg sale helpwithassignment money slots
buy zyvox 600mg online play live poker online online casinos for usa players
buy lopressor for sale buy vardenafil 10mg sale levitra 10mg tablet
vardenafil 20mg tablet vardenafil without prescription methylprednisolone 16mg over the counter
helpwithassignment thesis writing services sildenafil overnight delivery
aristocort for sale clarinex for sale online desloratadine sale
buy generic tadalafil 20mg sildenafil 100mg tablets purchase sildenafil
order orlistat without prescription cost acyclovir 800mg order acyclovir 800mg generic
cialis 10mg oral clopidogrel generic plavix
buy baclofen 10mg cost baclofen 25mg toradol cheap
buy flomax generic tamsulosin 0.4mg for sale spironolactone 25mg cost
us cialis sales ampicillin oral cipro order online
help with essay writing purchase essays stromectol liquid
sildenafil next day sildalis over the counter lamotrigine pills
free spins no deposit canada over the counter erectile dysfunction pills cialis without a doctor prescription
free spins no deposit canada order stromectol generic buy modafinil 100mg sale
generic prednisone 40mg deltasone 10mg for sale mebendazole drug
fildena 100mg usa order fildena online order budesonide generic
purchase tiotropium bromide online buy terazosin online order terazosin 1mg
singulair 5mg brand buy sildenafil 50mg without prescription viagra drug
diamox 250mg us order diamox online buy imuran sale
coreg 6.25mg cost purchase elavil without prescription order amitriptyline 50mg pill
cheap amoxil online order amoxil 500mg stromectol 3 mg
order pamelor 25 mg for sale paroxetine online order paxil 10mg oral
buy indomethacin 75mg pills order indomethacin 75mg pills order cenforce 50mg sale
buy generic pepcid 20mg pepcid tablet order remeron 30mg sale
doxycycline 200mg generic buy methylprednisolone tablets medrol 8mg for sale
order requip 1mg without prescription ropinirole for sale buy labetalol 100 mg pills
purchase tadacip sale buy amoxicillin online cheap buy amoxicillin 500mg online
cost esomeprazole generic biaxin purchase furosemide for sale
buy cialis 40mg without prescription approved levitra medication for ed
buy glucophage 500mg online glycomet 1000mg generic order nolvadex for sale
accutane 10mg ca cost accutane 40mg ampicillin antibiotic online
sildenafil 100mg tablet pregabalin 75mg for sale purchase finasteride pills
accutane 40mg pill accutane without prescription buy zithromax 250mg sale
provigil 200mg drug zestril 5mg drug purchase metoprolol for sale
order generic prednisolone order prednisolone pills lasix 100mg usa
purchase dutasteride generic purchase avodart sale xenical cheap
order monodox pill doxycycline 200mg generic buy generic zovirax 800mg
buy azathioprine 50mg azathioprine 50mg ca naprosyn 500mg pill
generic oxybutynin trileptal order cost oxcarbazepine
cefdinir oral order prevacid 30mg generic protonix 20mg for sale