开发者

Use php to save text box content to a page

Im trying to build a extremely basic content management system. I want to do it all with php and was hoping it would be as simple as echoing content that was submitted in a text form.

The problem is I need to save the echoed content to the开发者_如何学Python page somehow (preferably without a database) and then have it replaced with new echoed content if it is submitted. How would I save the content to the page?

Thanks in advance.


If you're dead set against using a database, the absolutely most basic thing you could do would be to save the contents to a file using file_put_contents(). You could reload it using file_get_contents(). Please be aware, though that you may be exposing yourself to various security exploits such as cross site scripting attacks and code injection attacks. Also, you may run into concurrency issues with one user wiping out another user's edits. You may also run into file permissions issues. If your site gets a lot of traffic, you might run into scalability and performance issues. As you start to research these issues, you'll start to appreciate why things quickly get more complicated than you initially want them to be.


Not sure what you're asking.

You can actually re-write the page with (fopen, fwrite, I think...) on submission.

If you wanted to "carry" the info around use the session variables.

Both of these methods could get un-weildly for high traffic sites though.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜