English 中文(简体)
我怎么能使地方的超文本能够用到地方档案中。 [闭门]
原标题:How can I cause a local HTML to page save text to a local file? [closed]

I m 撰写一份简单的超文本+Java文本,意在从地方档案中装满,并在用户浏览器上运行。 这将使他们能够把某些案文变成一个文本。

因此,我的问题是:鉴于贾瓦伦古特没有机会进入地方档案系统,我如何能够拯救这一文本?

问题回答

您应在超文本网页上使用<代码>form要素制作一个表格。 之后,创建了一个服务器边的文字(PHP、Riru、Adhury),处理你的格式数据。 您可以通过POST或GET的请求转让数据。

<form method="post" action="/process.php">
    <textarea name="text"></textarea>
    <button type="submit">Send data</button>
</form>

<代码>process.php:

if (isset($_POST["text"]))
{
    file_put_contents("my_file.txt", $_POST["text"]);
}

您的文本箱是否以形式出现? 如果是,将其内容带入实验室并撰写。

如果没有,则将内容列入javascript,Ajax则向一个将撰写该书的php文字发出呼吁。

页: 1

As far as I know you can t use javascript or other client-side scripting language for security reasons so you have to use a server-side language like PHP, Ruby, Python etc... Generally speaking you have to create your HTML form and ad a button to send the data to your server so you can process it.

BTW 你的问题确实不完整。 也许你可以ed,我们可以更具体。

<form method="post" action="/file.php">
    <textarea name="what_i_want_to_save"></textarea>
    <button type="submit">Submit</button>
</form>

In method you can use also get. Then in file.php you can do something following this link http://php.net/manual/en/function.fwrite.php if you want to use php.





相关问题
CSS working only in Firefox

I am trying to create a search text-field like on the Apple website. The HTML looks like this: <div class="frm-search"> <div> <input class="btn" type="image" src="http://www....

image changed but appears the same in browser

I m writing a php script to crop an image. The script overwrites the old image with the new one, but when I reload the page (which is supposed to pickup the new image) I still see the old one. ...

Firefox background image horizontal centering oddity

I am building some basic HTML code for a CMS. One of the page-related options in the CMS is "background image" and "stretch page width / height to background image width / height." so that with large ...

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签