日期:2014-05-17 浏览次数:20767 次
<?php if $id=1 { echo "<title> $row['p_name']; - 欢迎光临!</title> <meta name="keywords" content="$row['p_name'];,关键字测试" /> <meta name="description" content="$row['p_name'];,描述测试" /> "; } else { echo "<title>Welcome</title> <meta name="keywords" content="关键字测试" /> <meta name="description" content="描述测试" /> "; } ?>
<?php if( $id === 1 ) { echo "html <title> {$row['p_name']} - 欢迎光临!</title> <meta name=\"keywords\" content=\"{$row['p_name']},关键字测试\" /> <meta name=\"description\" content=\"{$row['p_name']},描述测试\" /> "; } else { echo " <title>Welcome</title> <meta name=\"keywords\" content=\"关键字测试\" /> <meta name=\"description\" content=\"描述测试\" />"; } ?>
------解决方案--------------------
<?php
$title = ''; $keywords = ''; $description = '';
if($id==1){
$title = $row['p_name'];
$keywords = $row['p_name'];
$description = $row['p_name'];
}?>
<title><?php echo $title;?></title>
<meta name="keywords" content="<?php echo $keywords;?>,关键字测试">
<meta name="description" content="<?php echo $description;?>,关键字测试">
------解决方案--------------------
- - 傻了,上面第一行应该是$title = 'Welcome'