我必须在数据库中存储一些数据。
Database Table:
[id] - [name] - [detail]
[1 ] - [site_url] - [http://localhost.com]
[2 ] - [home_url] = [http://localhost.com]
我正在使用此代码进行预览。
$options = get_data($conn);
if(!empty($options)){
foreach ($options as $Option) {
$id = $Option['option_id'];
$name = $Option['option_name'];
$detial = $Option['option_detail'];
// here i want to match option detail if site_url or home_url is same
// so include('homepage.php');
else
header('location: '.$detail) // go to home_url
}
}
我已经在$ detial = $ Option ['option_detail'];
之后在foreach循环中尝试了这段代码if($name == 'site_url'){
$site_url = $detail;
}
if($name == 'home_url'){
$home_url = $detail;
}
if($site_url == $home_url){
include('home.php'){
exit();
}else{
header('location: '.$home_url);
exit();
}
}