打开文本文件,查找文本中有多少位数。 [英] Open a text file and find how many digits are there in the text.

查看:74
本文介绍了打开文本文件,查找文本中有多少位数。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

$handle = fopen("mytext.txt", "r");

echo fread($handle,filesize("mytext.txt"));
echo preg_match("/[0-9]/","",$handle);

fclose($handle);





我尝试过:



我试图使用preg_match,但我认为这不是正确的方法。



What I have tried:

I tried to use preg_match but I think this is not correct way to do it.

推荐答案

handle = fopen( mytext.txt r);

echo fread(
handle = fopen("mytext.txt", "r"); echo fread(


handle,filesize( mytext.txt));
echo preg_match( / [0- 9] /
handle,filesize("mytext.txt")); echo preg_match("/[0-9]/","",


手柄);

fclose(
handle); fclose(


这篇关于打开文本文件,查找文本中有多少位数。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆