php案例 计算字符串单词数量
        【摘要】 
                    
                        
                    
                     
 作者:陈业贵 华为云享专家 51cto(专家博主 明日之星 TOP红人) 阿里云专家博主 
 
 文章目录
 什么是单词?cyg.php
 
 
 
什么是单词? 
举个例子: aaa aaa...
    
    
    
    作者:陈业贵 华为云享专家 51cto(专家博主 明日之星 TOP红人) 阿里云专家博主
什么是单词?
举个例子:
 aaa aaa aaa
 这就是三个单词。
cyg.php
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <title> 计算字符串单词数量 </title>
  <meta name="Generator" content="EditPlus">
  <meta name="Author" content="author">
  <meta name="Keywords" content="dz5362">
  <meta name="Description" content="no-description">
  <meta http-equiv="Content-type" content="text/html;charset=GB2312">
<link rel='stylesheet' type='text/css' href='style.css' />
 </head>
 <body>
	<div id="header">计算字符串单词数量</div>
	<div id="content">
		<center>计算字符串单词数量</center>
		<center>
		<form method="post" action="cyg.php">
			<input type='text' value='Hello PHP!' name='word'><br>
			<b>注意:输入的字符必须为大小写字母</b><br>
			<input type="submit" value="提交" name='sel' id="input">
		</form>
		</center>
	<?php
		if(!empty($_POST['word'])){//获取数据如果不为空执行if
			$str = $_POST['word'];//获取输入的所有的字符串
			$num = str_word_count($str);//计算单词数量
			echo "<script>alert('单词的数量为:".$num."')</script>";//输出单词数量
		}
	?>
	</div>
 </body>
</html>
  
 
 - 1
 - 2
 - 3
 - 4
 - 5
 - 6
 - 7
 - 8
 - 9
 - 10
 - 11
 - 12
 - 13
 - 14
 - 15
 - 16
 - 17
 - 18
 - 19
 - 20
 - 21
 - 22
 - 23
 - 24
 - 25
 - 26
 - 27
 - 28
 - 29
 - 30
 - 31
 - 32
 - 33
 

文章来源: blog.csdn.net,作者:贵哥的编程之路(热爱分享),版权归原作者所有,如需转载,请联系作者。
原文链接:blog.csdn.net/qq_37805832/article/details/127000916
        【版权声明】本文为华为云社区用户转载文章,如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱:
            cloudbbs@huaweicloud.com
        
        
        
        
        
        
        - 点赞
 - 收藏
 - 关注作者
 
            
           
评论(0)