【发布时间】:2015-03-16 22:22:43
【问题描述】:
我正在运行网站,该网站在每个页面上加载 main.php 文件,它有数千个页面。每个页面 url 都是不同的,例如,
mywebsite.com/United-Kingdom.php
和
mywebsite.com/United-Stats-of-america.php.
每个页面都有唯一的页面标题,由 PHP 从数据库中加载,
(<h4 style="font-size:20px;color:#148ADB;"><?php echo $cityname['country']; ?>Information</h4>)。
我想用 url 或页面标题自动更改标题 jpg 图像,例如,如果用户转到 United-kingdom url,则图像应该在标题上加载 /images/country/united-kingdom.jpg 并且当用户打开 United Stats 页面时应该在标题上加载图像 /images/country/united-stats.jpg。
我怎样才能做到这一点?
= now() 按票价排序"); $arr1=mysql_fetch_array($sel1); ?><div id="content-top-txt" style="height:auto">
<div id="content-top-inner1">
<div id="content-top-txt-inner1" style="height:auto">
<div class="content">
<h4 style="font-size:20px;color:#148ADB;"><?php echo $cityname['country']; ?>specials</h4>
<p style='text-align:justify; font-size:13px; color:#3c3c3c;'>
<strong style="text-transform:uppercase;color:#148ADB;"><?php echo $cityname['country']; ?></strong> with choice of range prices think of comfort for lesser cost<strong style="text-transform:uppercase"><?php echo $cityname['country']; ?></strong> starts from <?php
$tempcode=$arr1['des_code'];
$stemp=mysql_query("SELECT * FROM cities_var WHERE code='$tempcode'");
$temp=mysql_fetch_array($stemp);
if($temp['code']=='')
{
?>
<strong><?php echo $arr1['des_name'];?> (<?php echo $arr1['des_code']; ?>) </strong>
<?php
}
else
{
?>
<a href="<?php echo $temp['url'] ?>" target="_blank"><strong><?php echo $arr1['des_name'];?> (<?php echo $arr1['des_code']; ?>) </strong></a>
<?php
}
?>
@ <strong>£<?php echo $arr1['fare']; ?></strong> with & table below<?php echo $arr1['des_name'];?> & other cities in <strong style="text-transform:uppercase"><?php echo $cityname['country']; ?></strong> About<strong>UK</strong>.General information About <strong style="text-transform:uppercase"><?php echo $cityname['country']; ?></strong>call @ 123456789 or use <a href="../../form.php">Form</a> or email:- <strong>Email@address.com</strong></p>
<p><?php echo $cvar['overview2']; ?></p>
<p>Note:-Prices given are excluding taxes</p>
</div>
<div id="content-top-inner2">
<div id="content-top-txt-inner2" style="height:auto">
<!-- slider start here -->
<div class="slider-main">
</div> <!-- slider end here-->
</div><!-- Content-top-txt-inner2 end-->
</div><!-- content-top-inner2 end here-->
</div><!--contaent-top-txt end here -->
</div><!--content-top end here -->
<div id="content-middle">
<div id="content-middle-txt">
<?php
include("../../files/lb1.php");
?>
<div class="content-middle-txt-right">
<?php
include("../../files/d-search-compare.php");
?>
</div>
<div style="clear:both"></div>
<div class="more"><p><span>Note : </span><?php //echo $sql_rec['note']; ?></p><p>paragraph text.</p>
</div> <!--content-middle-txt end -->
</div> <!--content-middle end -->
<div id="content-bottom">
<div id="content-bottom-txt">
<div id="bottom-all-box">
<?php
include("../../files/lb2.php");
?>
<div id="content-bottom-right">
<?php
include("../../files/rb1.php");
?>
</div>
</div>
<?php
/*
include("../../files/country-left-box3.php");
include("../../files/country-right-box1.php");
*/
?>
【问题讨论】:
-
用 URL 或页面标题更改每个页面上的图像源的 PHP 代码
-
我试图复制粘贴我的代码,但它不包括 PHP 代码。
-
将您的代码粘贴到问题中,选择它并按“代码”按钮 - 它会缩进它,这是格式化代码的 Markdown 方式。
-
亲爱的我已尽力粘贴完整代码,请检查...
-
请您花点时间以正确的方式放置代码。你的帖子现在真的很乱。