PHP学习笔记--php关键字突出
2013-05-23 20:04
393 查看
没有用正则和ajax 大家可以自己去尝试用。
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>无标题文档</title> </head> <body> <form action="#" method="get"> <input type="text" name="txts" /> <input type="submit" value="描红关键字" /> </form> <?php $txt = $_GET['txts']; $str = ' PHP 手册 Stig Sæther Bakken Alexander Aulbach Egon Schmid Jim Winstead Lars Torben Wilson Rasmus Lerdorf Andrei Zmievski Jouni Ahto 中文文档翻译小组 穆少磊 肖盛文 宋琪 李达 黄啸宇 王远之 陈伯乐 崔岩 刘铭 周皓 Yorgo 文件生成时间: Thu Mar 11 18:34:33 2004 请访问 http://www.php.net/docs.php 获取最新的版本 Copyright © 1997, 1998, 1999, 2000, 2001, 2002 the PHP Documentation Group '; ?> <?php if(isset($txt) && ord(trim($txt)) != 0) //判断提交 { $txt = strtolower($txt); //转小写 $str = "<pre>".str_replace($txt,"<font color='#FF0000'>$txt</font>",$str)."</pre>"; $txt = strtoupper($txt); //转大写 echo "<pre>".str_replace($txt,"<font color='#FF0000'>$txt</font>",$str)."</pre>"; } else { echo "<pre>".$str."</pre>"; } ?> </body> </html>
相关文章推荐
- 我的php学习笔记(三十七) PHP站内搜索:多关键字、加亮显示
- php学习笔记------[php面向对象中常用关键字与魔术方法]
- php学习笔记------[php面向对象中常用关键字与魔术方法]
- 我的php学习笔记(三十七) PHP站内搜索:多关键字、加亮显示
- PHP学习笔记七之类与面向对象(进阶篇)
- PHP学习笔记之数组操作//待完善V1.0
- 【小白笔记】PHP学习之路 (20) --类的初始化、析构函数与继承
- PHP学习笔记-->007 PHP函数
- php学习笔记(二十五)php中cookie的使用和控制
- Java学习笔记---一些关键字的使用
- PHP中static关键字原理的学习研究分析
- PHP学习笔记。小技巧
- C语言学习笔记(一) 关键字
- PHP学习笔记之身份证验证程序
- THINK PHP 学习笔记20171115
- PHP字符串处理学习笔记
- PHP学习笔记【9】--PHP程序流程控制
- PHP学习笔记
- PHP学习笔记 - 进阶篇(6)
- PHP学习笔记(一):基本语法之标记、空白、和注释