Question

I have a text file with some quotes and I want to use php or laravel...

I have a text file with some quotes and I want to use php or laravel to pull one quote at a time and display it to my website upon every page refresh. How do I use PHP or Laravel to pull one quote at a time from the text file (saved in my project as quotes.txt) and display it on my webpage? I am also open to using ajax and/or javascript.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Answer

  • It is very simple.
  • Just use cookies.
  • Idea is first set a cookie with any name and set it to 0.
  • Then every time check if cookie is set.
  • If it is set, just take it and save it in a variable.
  • If it is not set, just set it .
  • Now, from the variable value , now take the quotes from txt and put them in an array.
  • Now the access the variable values quote from the array.
  • If the cookie value reaches to number of quotes just set it to 0.
Add a comment
Know the answer?
Add Answer to:
I have a text file with some quotes and I want to use php or laravel...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Hi, i am working with MATLAB. I have a text file from which I have to...

    Hi, i am working with MATLAB. I have a text file from which I have to read in my data. So far i have this in my code. fid = fopen('ecgnormaloff.txt', 'r'); data = textscan(fid,'%f') According to all the websites, this should be enough to read in my points, however, I get this as my output data = 1×1 cell array {0×1 double} >> And when I try to access my data, there is nothing. I do not want to...

  • Hello, I would greatly appreciate it if anyone could help me. I saved a text file...

    Hello, I would greatly appreciate it if anyone could help me. I saved a text file in the C drive of my computer. I need to use open the text file to do my homework. But when I used the Python 3.7 to open the file, I got error message: NO SUCH FILE OR DIRECTORY. What should I do to open the file using the Python. Many thanks for your help.

  • I have a web development project. First, it requires to have a website with a simple...

    I have a web development project. First, it requires to have a website with a simple design like the picture. Second, after fill in the information in the text box, click submit, the information will be save in the database using MySQL. Must have a captcha (like Google Captcha) to reduce spam. Also, must have a database password encryption. You can code this using php, html for coding, and css for designing. Third, code a php file to show all...

  • Do you have experience on using php strom for the html documents? I am not quiet...

    Do you have experience on using php strom for the html documents? I am not quiet sure why do I see error on deployment my files, it says no files or folder to found to process. I saved my html and image files into the folder and tried to deploy the folder to ftp server. every time I do that see the error and it does not upload files and says the no files or folder to found to process....

  • I am writing a program in C++, which requires me to read an input text file...

    I am writing a program in C++, which requires me to read an input text file using command line argument. However, I am using xcode on my Macbook to write C++ program, and use terminal instead of command. How do you use int main(int argc, char** argv[]) to read an input file. My professor requires us not to hard code the text file name like .open("example.txt"); Thank you!

  • C Programming: I have a text file which has this on it 1 2 3 4...

    C Programming: I have a text file which has this on it 1 2 3 4 5 6 I want my output to display 123456 How do I do this?

  • Create an HTML5 page that contains a form to collect the following data. The text in...

    Create an HTML5 page that contains a form to collect the following data. The text in bold indicates the id value that should be assigned to each html control: Product (drop down list) product – iPad, iPhone 6S, Galaxy 5S, Moto X, and so on Quantity (number) quantity Unit price (number) unit_price Discount (%)(number) discount_rate Date (date)   order_date First Name (text box)   first_name Last Name (text box)   last_name Payment type (drop down list)   payment_type – Visa, Master, Discover, Amex, and...

  • I need a small website that to where I need to interlink a CSS file into...

    I need a small website that to where I need to interlink a CSS file into the HTML file. I don't know to save the files to have to be able to run with the CSS attributes show up in the browser when I do click the "open with" after I click on the saved HTML file. Basically when I copy files from the internet, to see if the HTML and CSS would interlink and run, the HTML would run...

  • Use two files for this lab: your C program file, and a separate text file containing...

    Use two files for this lab: your C program file, and a separate text file containing the integer data values to process. Use a while loop to read one data value each time until all values in the file have been read, and you should design your program so that your while loop can handle a file of any size. You may assume that there are no more than 50 data values in the file. Save each value read from...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT