|
发表于 2017-1-13 17:09:13
|
显示全部楼层
来自 中国湖北恩施土家族苗族自治州
- <?php
- $arr1=array("1","2","3","4","5","6","7","8","9","0");
- $arr2=array("一","二","三","四","五","六","七","八","九","零");
- function str_rep($a,$b,$str)
- {
- $res=str_replace($a, $b, $str);
- return $res;
- }
- print_r(str_rep($arr1,$arr2,$_POST['str']));
- ?>
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <title>demo</title>
- </head>
- <body>
- <form action="" method="post">
- <p><input type="text" name="str"></p>
- <p><button type="submit">submit</button></p>
- </form>
- </body>
- </html>
复制代码 |
|