리눅스 시스템전화로 기능 오류
내 기능에 대한 도움말을 찾으십시오. 나는 그들을 새로운 배우게됩니다. 동일한 코드를 너무 많이 쓰지 않도록하는 함수를 만드는 것은 언급되었습니다.
나는 그들에 관해 많은 페이지를 발견했는데 도움을 주었지만 여전히 문제가 발생했다.
로그 오류가 발생하지 않으며 아무 것도 생성되지 않습니다. 나는 무언가로 시작할 때 항상 실수를해서 뭔가를 놓친다는 것을 압니다.
여기까지 제가 지금까지 있습니다.
미리 감사드립니다. 가 동일하고, 그 부분이 작동하는지
밥
<?php
$dirPath = "Path to File Location";
$buildPath = "Path to File Location";
function createFiles() {
for ($i = 1; $i < 45; ++$i) {
$filename = $buildPath . '/$area'. sprintf("%02s", $i) . '.php';
if (!file_exists($buildPath$filename)) {
$myfile = fopen($buildPath$filename, "w") or die("Unable to open item$i file!");
fwrite($myfile, $txt1);
fwrite($myfile, $addtitle);
fwrite($myfile, $incltxt);
fclose($myfile);
chmod("$buildPath"."$area"."$i".".php", 0755);
}
// fopen, fwrite, fcloses...
// filename for delete page setup
if (!file_exists("$dirPath"."delete.page.php")) {
$myfile = fopen("$dirPath"."delete.page.php", "w") or die("Unable to open file!");
$txt = "<option value=\"\">Select Page to Delete......</option>\n
<option value=\"generalinfo.tx\">General Information Page.</option>\n
<option value=\"$filename\">$area Pg. $i</option>\n";
fwrite($myfile, $txt);
fclose($myfile);
chmod("$dirPath"."delete.page.php", 0755);
}
else
{
$myfile = fopen("$dirPath"."delete.page.php", "a") or die("Unable to open file!");
$txt = "<option value=\"$filename\">$area Pg. $i</option>\n";
fwrite($myfile, $txt);
fclose($myfile);
chmod("$dirPath"."delete.page.php", 0755);
}
break;
}
return true;
}
if ($i == 1) {
createFiles();
}
// Once we get more than 4 items written in each file we need a new file.
// This can happen maximum 11 times for each session
if ($i == 5) {
createFiles();
}
if ($i == 9) {
createFiles();
}
if ($i == 13) {
createFiles();
}
if ($i == 17) {
createFiles();
}
etc......
if($i == 49) {
echo "<br />Maximum of 12 pages hit. Time to delete a few";
}
?>
어떤 오류가 발생합니까? –
'$ buildPath. $ filename' ~'$ buildPath. $ filename' –
이것이 예상대로 작동하지 않는다는 표시가 있습니까? 문제를 좁히기 위해 어떤 시도를 했습니까? – David