This is very simple PHP Random Script to get Text from txt file and show it where you want to show. You can easy include it by PHP code or using java script to include it. With java script, you can easy share your random quote, just give theme a code, that’s all. PHP Random Quote run with 4 files inside. Here is how you install it:
Upload all file inside folder: php-random-quote to your web host. Edit file bienthuy.txt to your need.
One quote per line. You can enter quote as much as you want, just remember ONE PER LINE
Then run it in your browser:

Demo PHP Random Quotes:

If you want to share it, just give your friend Java Script like this:

<script type="text/javascript" src=""></script>

Files Content: ONE PER LINE, you can use html code in this txt file.

Không có gì quý hơn độc lập tự do
Vietnam Today Travel - <a href="">Vietnam Tours</a>
UTF-8 Supported - <a href="">Biên Thùy</a>
UTF-8 with <i><b>HTML code</b></i> Supported <b>Bold</b> and <i>Italic</i> <font color="#0066cc">Event color </font>- <a href="">Biên Thùy</a>
Huy Hoa - <a href="">Huy Hòa</a>!
Nothing gonna change my love for you
Go to - <a href="">Biên Thùy</a> for details and download link


* Shared by BienThuy.Com
* www.BienThuy.Com
* wWw.HuyHoa.Com
* [email protected]
* Yahoo: huyhoa
* Skype: admin.vtt
* Facebook:
* Twitter:
* @ 2013. All Rights Reserved.
/* File, where the random text/quotes are stored one per line */
$settings['text_from_file'] = 'bienthuy.txt';
$settings['quotes'] = array(
   How to display the text?
   0 = raw mode: print the text as it is, when using RanTex as an include
   1 = Javascript mode: when using Javascript to display the quote
$settings['display_type'] = 1;
/* Allow on-the-fly settings override? 0 = NO, 1 = YES */
$settings['allow_otf'] = 1;
*  ...or at least make a backup before you do!
/* Override type? */
if ($settings['allow_otf'] && isset($_GET['type']))
    $type = intval($_GET['type']);
    $type = $settings['display_type'];
/* Get a list of all text options */
if ($settings['text_from_file'])
    $settings['quotes'] = file($settings['text_from_file']);
/* If we have any text choose a random one, otherwise show 'No text to choose from' */
if (count($settings['quotes']))
    $txt = $settings['quotes'][array_rand($settings['quotes'])];
    $txr = 'No text to choose from';
/* Output the image according to the selected type */
if ($type)
    /* New lines will break Javascript, remove any and replace them with <br /> */
    $txt = nl2br(trim($txt));
    $txt = str_replace(array("\n","\r"),'',$txt);
    echo 'document.write(\''.addslashes($txt).'\')';
    echo $txt;

Using:  If you use PHP, then include it where you want to show

<?php $_GET['type'] = 0; include 'btrand.php'; ?>

If you want to use Java Script or want to share, use this code:

<script type="text/javascript" src="/ht/btrand.php?type=1"></script>

If share, just edit the link:

<script type="text/javascript" src=""></script>

Download PHP Random Quote:

4.6/5 - (6935 bình chọn)

Trả lời

Email của bạn sẽ không được hiển thị công khai. Các trường bắt buộc được đánh dấu *