fix
This commit is contained in:
parent
b8c98693f8
commit
62bb16f581
3
post.php
3
post.php
@ -10,9 +10,6 @@ require_once "vendor/autoload.php";
|
||||
ini_set("display_errors", true);
|
||||
error_reporting(-1);
|
||||
|
||||
//$fileName = "Information.txt";
|
||||
//$fileModeOpen = "a";
|
||||
|
||||
$post = new PostModel();
|
||||
$post->load($_REQUEST);
|
||||
$post->save();
|
||||
|
4
post.txt
4
post.txt
@ -1,4 +1,6 @@
|
||||
autoincrement=id;last_id=2;table_name=post
|
||||
autoincrement=id;last_id=4;table_name=post
|
||||
id;author;post
|
||||
1;Stas;Hello, world!!!
|
||||
2;Stas;Hello, world!!!
|
||||
3;Stas;Hello,<br>My php<br>World!!!
|
||||
4;Stas;Hello,<br>My php<br>World!!!
|
||||
|
@ -151,24 +151,6 @@ class FileDatabaseDriver
|
||||
fclose($this->file);
|
||||
}
|
||||
|
||||
// public function updateServiceInfo(string $string): void
|
||||
// {
|
||||
// $id = $this->serviceInfo['last_id'];
|
||||
// $this->serviceInfo['last_id'] = ++$id;
|
||||
// foreach ($this->serviceInfo as $key => $value) {
|
||||
// $arr[] = $key . '=' . $value;
|
||||
// }
|
||||
// $fileArr = file($this->filePath);
|
||||
// if (isset($arr)) {
|
||||
// $serviceStr = implode(';', $arr) . "\n";
|
||||
// }
|
||||
// $fileArr[0] = $serviceStr;
|
||||
// file_put_contents($this->filePath, $fileArr);
|
||||
//
|
||||
// $str = $id . ';' . $string;
|
||||
// $this->save($str);
|
||||
// }
|
||||
|
||||
public function save(string $string): void
|
||||
{
|
||||
$this->serviceInfo['last_id']++;
|
||||
@ -182,7 +164,7 @@ class FileDatabaseDriver
|
||||
$fileArr[0] = $serviceStr;
|
||||
file_put_contents($this->filePath, $fileArr);
|
||||
|
||||
$str = $this->serviceInfo['last_id'] . ';' . $string . "\n";
|
||||
$str = $this->serviceInfo['last_id'] . ';' . str_replace("\r\n", "<br>", $string) . "\n";
|
||||
fwrite($this->file, $str);
|
||||
|
||||
$this->close();
|
||||
|
Loading…
Reference in New Issue
Block a user