<?PHP
// primarily a method for storing data
// arrays are counted from 0
$hosts = array(
array("ronmexico.kainalopallo.com/","beforename=$F_firstname%20$F_lastname&gender=$F_gender","Your Ron Mexico Name is ","/the ultimate disguise, is ([^<]+)<\/b><\/u>/s"),<u><b>([^<]+)<\/b><\/u>/s"),
array("rumandmonkey.com/widgets/toys/mormon/index.php","gender=$F_gender&firstname=$F_firstname&surname=$F_lastname","Your Mormon Name is ","/
My <p>My Mormon name is
<b>([^<]+)<\/b>!<br \/>/s")
);
return $hosts;
?>
How to store this array into mysql database.
You can use json_encode when storing:
$fruit_color = array("apple" => "red", "banana" => "yellow", "cherry" => "red");
$encoded = json_encode($fruit_color); //Turn your array into json-readable string
And json_decode when retrieving from database:
$result = mysql_fetch_assoc($sql);
$decoded = json_decode( $result[column_name] );
just iterate the array and insert every element into the table
foreach($hosts as $key => $value){
mysql_query('INSERT INTO table (field) VALUES ("'.$value.'")');
}
您可以使用PHP 序列化功能在MySQL中存储数组和对象
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.