编写文本文件时出错

时间:2016-05-20 13:33:46

标签: php

我是PHP的初学者。我想在.txt文件中写一些数字。我在phpstorm程序中编写了这段代码:

<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <title>Untitled Document</title>
</head>

<body>
<?php
$l=5;
$a = fopen("./mmm.txt", "w");
for ($m = 1;$m <=3 ; $m++) {
    for ($j = 1; $j <= 2 ^ $m; $j++) {
        for ($i = 1; $i <= $l - $m; $i++) {
            fwrite($a,$j * 2 ^ ($i - 1));
        }
    }
}
fclose($a);
?>
</body>
</html>

当我在Mozilla Firefox中运行此代码时,我面临以下错误: 允许的内存大小为134217728字节耗尽(试图分配36个字节)...或者超过最大执行时间120秒......

并且mmm.txt文件的大小约为138000 KB。 怎么了?

0 个答案:

没有答案