Questions about PHP generated text _php tutorial

Source: Internet
Author: User
Tags php class
Problem
Questions about PHP generated text
Workaround
Hello, my brother has a problem.

I now upload a bit of data, such as my profile and so I want to add a "download" button at the front desk, click this button will send my uploaded data from the server automatically generated text, and then download to the local save!

Who knows, is there any good way? Give some hints also good ah, I now have no clue, I just learn program soon!

Thank you all!


Reference answer
.. What did you upload? data. Bmp? Php?
Reference answer
is Text! Like the news text, including the topic date content and so on, is there a way?
Reference answer
The ability to understand is not very good. I don't know what you're talking about.
Reference answer
This should be very simple, fopen---fwrite---fclose, you can refer to the basic textbook text file written code.
Reference answer
I seem to know what you're doing.



Note: The directory where the files are located

$fileDir = './mydata ';



Note: Detects if the directory is readable

if (!is_readable ($fileDir)) {

Die (' Insufficient authority ');

}



Note: initial array of files

$fileData = Array ();



Note: Read the file

$handler = fopen ($fileDir);

while (($filename = Readdir ($handler)) = = FALSE) {

if (!in_array ($filename, Array ('. ', '. '), TRUE)) {

$fileData []=file_get_contents ($filename);

}

}



Note: You need the operation, directly with $filedata this array is ok


Copy code I don't know if it's what you want.
Reference answer
I haven't practiced your code, but it doesn't seem to be a good idea.
Download a file without requiring you to list all directories in the array

Landlord, what do you need to download?
How the front desk displays the downloaded
Direct display path plus file name $filename = ' Xiaoasp.txt '; Here I test the machine, you can use the variable to get the file name with get

Header ("Content-type:application/force-download"); Because the TXT file is parsed by the browser by default, it is forced to download

ReadFile ($filename); Then it's the output file.

Exit


Copy Code
Reference answer
In fact, my idea is very simple, I just want to:

In the background of the page, the news according to "title, date, author and content" form to the server.
The fields on the server are ID title date author content

So I can see my uploaded news at the front desk, this is easy to implement with PHP.

But I suddenly think, in my backstage add a "download" button, it to achieve the effect is: Click, it will automatically put me one months (the default) uploaded to the server all the news in text or Word form to save to the local, so I can later without the internet can also see my previous upload news, Did you get it?

Of course, this is just an example, don't ask me why not save and then upload the news! Ha ha
Reference answer
Word format ah? It's not that simple. You search the Internet for a PHP class that generates Word format files.
Reference answer
Text also line, anything can, I want to be able to download down!

http://www.bkjia.com/PHPjc/632582.html www.bkjia.com true http://www.bkjia.com/PHPjc/632582.html techarticle questions about PHP generated text how to solve the problem all right, my brother has a problem I now upload a bit of data, such as my profile and so I would like to add a "under the front desk" ...

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.