産品描述採用3段文字組合,爾每一段文字都是用十幾個詞語組成的,而這十幾個詞語是由TBS僞原創工具衍生出來的,所以每次看到這段文字內容都會不同,更別說3段文字了。這其中的詞語中還可以加入長尾詞,插入了産品名稱。
代碼如下 test.php
<?php
$conn= @mysql_connect("localhost","root","") or die ("Contect Error!");
mysql_select_db("test",$conn);
$a = rand(1,3);
$b = rand(1,3);
$c = rand(1,3);
$d = rand(1,3);
$e = rand(1,3);
$sql1 = "SELECT tou FROM `test10` WHERE id=$a";
$sql2 = "SELECT zhong FROM `test10` WHERE id=$b";
$sql3 = "SELECT jiao FROM `test10` WHERE id=$c";
$query1 = mysql_query($sql1,$conn);
$query2 = mysql_query($sql2,$conn);
$query3 = mysql_query($sql3,$conn);
$row1 = mysql_fetch_array($query1);
$row2 = mysql_fetch_array($query2);
$row3 = mysql_fetch_array($query3);
$bb1 = explode("{",$row1['tou']);
for($i=0; $i<=100; $i++){
$cc1 = explode("|",$bb1[$i]);
$zj = count($cc1)-1;
$dd1 = rand(0,$zj);
$ee1 = $cc1[$dd1];
$ff1 .= " ";
$ff1 .= $ee1;
}
$bb2 = explode("{",$row2['zhong']);
for($i=0; $i<=100; $i++){
$cc2 = explode("|",$bb2[$i]);
$zj = count($cc1)-1;
$dd2 = rand(0,$zj);
$ee2 = $cc2[$dd2];
$ff2 .= " ";
$ff2 .= $ee2;
}
$bb3 = explode("{",$row3['jiao']);
for($i=0; $i<=100; $i++){
$cc3 = explode("|",$bb3[$i]);
$zj = count($cc1)-1;
$dd3 = rand(0,$zj);
$ee3 = $cc3[$dd3];
$ff3 .= " ";
$ff3 .= $ee3;
}
$mode1 = "/}/";
$mode2 = "/{/";
$mode3 = "/###/";
$x1 = '';
$x2 = '';
$x3 = '<strong>'.$products_name.'</strong>';
echo $x3;
$ff1 = preg_replace($mode1,$x1,$ff1);
$ff1 = preg_replace($mode2,$x2,$ff1);
$ff1 = preg_replace($mode3,$x3,$ff1);
$ff2 = preg_replace($mode1,$x1,$ff2);
$ff2 = preg_replace($mode2,$x2,$ff2);
$ff2 = preg_replace($mode3,$x3,$ff2);
$ff3 = preg_replace($mode1,$x1,$ff3);
$ff3 = preg_replace($mode2,$x2,$ff3);
$ff3 = preg_replace($mode3,$x3,$ff3);
$n='(1)'.$ff1.'.'.'<br><br>'.'(2)'.$ff2.'.'.'<br><br>'.'(3)'.$ff3.'.';
echo $n;
?>
資料庫代碼是:
--
-- 表的結構 `test4`
--
CREATE TABLE IF NOT EXISTS `test4` (
`id` int(5) NOT NULL,
`page1` text NOT NULL,
`page2` text NOT NULL,
`page3` text NOT NULL,
`page6` varchar(20) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- 轉存表中的資料 `test4`
--
INSERT INTO `test4` (`id`, `page1`, `page2`, `page3`, `page6`) VALUES
(1, 'Not only are they great on the bike, but very relaxing around the campsite and walking around town.', 'These sunglasses are awesome! They wrap around your face just enough to provide side-sun protection and at the same time, do not look bulky. Glad I have them.', 'I thought it would be nice and with casing as they mention that casing type:soft type. But when receive item, it didnt come with casing. This sunglasses like a toy.', 'Cangit'),
(2, 'Very good. Had absolutely no problems with the order and it was delivered very promptly. Love my Oakleys!', 'My son asked for these for Christmas, when he opened them all his brothers wanted a pair too! They look great and are reasonably priced for the type of sunglasses they are. ', 'Love the glasses. Light and they fit to perfection. Great buying experience all around.', 'Leona Collins'),
(3, 'very nice pair of sunglasses for shade/sun hiking or biking, driving or looking cool outside. clarity of vision with these are outstanding, construction is good.', 'I was a Ray Ban guy but I like Oakleys better. Great quality glasses, would buy again.', 'Excellent glasses. Comfortable, light-weight and they help me look good.', 'Chow'),
(4, 'Love these glasses and all the various lenses available depending on your needs. Highly recommend them.', 'great glasses, not too dark and they don''t fall off your head and hat! This is my second pair and it''s great to be able to switch out lens''', 'My son asked for these for Christmas, when he opened them all his brothers wanted a pair too! They look great and are reasonably priced for the type of sunglasses they are. ', 'Barbara Jean Griffin'),
(5, 'I like the way they fit by clinging to to your head. They are lightweight and comfortable as well. They are stylish and perform well at blocking the sun from your eyes. The frames are durable. ', 'so i bought these bout a month ago, great glasses! very clear lenses and very wide view.', 'This sunglasses is BOLD as hell and looks very very cool!', 'iMohammad'),
(6, 'Two thumbs up to the seller!! ', 'This is one of the sunglasses I like the most, they are very comfortable and durable, I recommend this a lot!', 'These glasses are great. They are very lightweight and durable. I am in the middle East right now and they have held up nicely in the heat and dry conditions. ', 'Pedro Ramirez'),
(7, 'I received the parcel earlier than I thought, not just that, I received it in a great perfect condition.', 'These are very nice sunglasses, they are my first pair of polarized glasses and I am very pleased with them.', 'i love these sunglasses!! my first pair were stolen, so i got another pair.', 'K.Benson'),
(8, 'I had these glasses before and they were stollen out of my car. I am repurchasing them becuase they were so nice. They were light weight and were a good size, not too bulky but not tiny.', 'Pleased with the glasses but they are definitely for a small face. After reading reviews I took this into consideration and am very glad I did. Reviews do help.', 'The lens are very good and definitely take the brightness out of the sun but still have good visibility.', 'Tim McAlpine'),
(9, 'My husband really loves these Oakleys and he had to have a pair because my son has them.', 'The Half Jackets were a great choice for me. I really love how they feel when i put them on because they fit perfectly! They also look really good on me and are stylish.', 'The glasses were beautiful, the customer service was very useful.', 'Schanen'),
(10, 'Bought for 17 year old who likes designer stuff. He is very happy with them.', 'They''re light weight, yet very sturdy. They also always seem to sit right and feel comfortable. I use them not only for driving, but bike riding and hanging out at the beach.', 'I had always wanted to own a pair of Oakley Sunglasses, these are my first ones and I love them.', 'Geoff');
本文出自 “電子商務解決方案” 部落格,請務必保留此出處http://wmrwx.blog.51cto.com/1418507/1300615