字符串表示


String representation

谁能告诉我这是为什么

$pole = explode("'n", file_get_contents('obce.txt'));
echo $pole[1];  //in obce.txt it is Test

不同
$pole[1]="Test";
echo $pole[1];

对我来说,似乎是一样的。

请记住,在Windows中,行尾字符是"'r'n"。

试题:

$pole = explode("'r'n", file_get_contents('obce.txt'));

我猜obce.txt在第一行只有一个字符串Test。如果是这种情况,那么当你读取文件并爆炸时,数组pole中将只有一个元素,要打印它,你需要这样做:

echo $pole[0];