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
replyImplement 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 "&^"?
replyhttp://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.
Please post the code to help you analyze