About rtrim
潘栋民
潘栋民 2019-04-11 12:22:28
0
6
1230

The '&^' character has been removed from line 9. How can line 11 be divided based on the '&^' character? I can't understand that there are two '&^' characters

潘栋民
潘栋民

reply all(1)
Peter-Zhu

Please post the code to help you analyze

  • reply Implement message board function: 1. The write.php file implements writing characters into local text: ```php <?php //追加方式打开文件 $fp=fopen('message.txt','a'); //设置时间 $time=time(); //得到用户名 $username=trim($_POST['username']); //得到内容 $content=trim($_POST['content']); //组合写入的字符串:内容和用户之间分开,使用$# //行与行之间分开,使用&^ $string=$username.'$#'.$content.'$#'.$time.'&^'; //写入文件 fwrite($fp,$string); //关闭文件 fclose($fp); header('location:index.php'); ?> ``` 2. The index.php file implements the front page for inputting content and displays the content that has been left: ```php <?php //追加方式打开文件 $fp=fopen('message.txt','a'); //设置时间 $time=time(); //得到用户名 $username=trim($_POST['username']); //得到内容 $content=trim($_POST['content']); //组合写入的字符串:内容和用户之间分开,使用$# //行与行之间分开,使用&^ $string=$username.'$#'.$content.'$#'.$time.'&^'; //写入文件 fwrite($fp,$string); //关闭文件 fclose($fp); header('location:index.php'); ?> ``` `$string = rtrim($string, '&^');` in the index.php file. I don't understand this code. "&^" is the demarcation of a message. The character "&^" has been removed here. Then the next sentence` $arr = explode('&^', $string);` How can we still use the character "&^"?
    潘栋民 author 2019-04-12 09:40:09
  • reply <?php //追加方式打开文件 $fp=fopen('message.txt','a'); //设置时间 $time=time(); //得到用户名 $username=trim($_POST['username']); //得到内容 $content=trim($_POST['content']); //组合写入的字符串:内容和用户之间分开,使用$# //行与行之间分开,使用&^ $string=$username.'$#'.$content.'$#'.$time.'&^'; //写入文件 fwrite($fp,$string); //关闭文件 fclose($fp); header('location:index.php'); ?>
    潘栋民 author 2019-04-12 09:40:44
  • reply http://www.php.cn/code/1192.html The code of this page. The format of pasting the code directly is too messy. I don’t know how to upload the code better.
    潘栋民 author 2019-04-12 09:41:52
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template