Here is a small series to bring you a PHP submission form when you keep multiple spaces and text style wrapping method. Small series feel very good, now share to everyone, also for everyone to make a reference. Let's take a look at it with a little knitting.
requirements are: the ability to mask sensitive words when a user submits a form. Sensitive words from the server side of the same path under the ciku.txt, sensitive words through the "|" connections, such as "g|c|a", replace sensitive words when submitting a form, and more importantly, you need to maintain the style of multiple spaces and line breaks that users enter in the form's text field and output them as-is. The PHP code is as follows:
<?phpheader ("Content-type:text/html;charset=utf-8"), if ($_post) { $pattern = array ( '//',//half-width space '/ /',//full-width space '/\r\n/',//window under line-break '/\n/',//linux,unix under line-break character ; $replace = Array (' ', ' ', ' <br/> '); $message =preg_replace ($pattern, $replace, $_post[' message '); $cikuStr =file_get_contents (' ciku.txt '); $CIKUARR =explode (' | ', $CIKUSTR); $liuyan =str_replace ($CIKUARR, "* *", $message); Echo ' Your message is:<br> '. $liuyan;}? >
1<!--This is the form page code--<body> <form name= "Message_board" id= "Message_board" method= "POST" action= " timu.php "> <textarea name=" message "id=" message "cols=" "rows=" > "http://www.cnblogs.com/ph pdream/"---Yong Quan </textarea><br/> <input type=" Submit "value=" Submission message "id=" Submitmessage " onclick=/> </form></body>
The effect is as follows: