我需要不同的徽标到关于页面和PHP中的其他页面?

时间:2017-08-03 05:44:09

标签: php codeigniter

我试图实现这样的徽标区分,请找出问题,谢谢 到目前为止我如何更改徽标差异

@if($title == 'About' ){
    <img src = "files/images/logo_wta_white.png" srcset = "files/images/logo_wta_white.png 1x, files/images/logo_wta_white@2x.png 2x" alt = "logo_wta_white">
@else
    <img src = "files/images/logo_wta.png" srcset = "files/images/logo_wta.png 1x, files/images/logo_wta@2x.png 2x" alt = "logo_wta">
@endif

2 个答案:

答案 0 :(得分:1)

对于核心php

if(basename($_SERVER['PHP_SELF']) == "about.php"){ /* basename($_SERVER['PHP_SELF']) Returns The Current PHP File Name */
<img src = "files/images/logo_wta_white.png" srcset = "files/images/logo_wta_white.png 1x, files/images/logo_wta_white@2x.png 2x" alt = "logo_wta_white">
}else{
<img src = "files/images/logo_wta.png" srcset = "files/images/logo_wta.png 1x, files/images/logo_wta@2x.png 2x" alt = "logo_wta">
}

答案 1 :(得分:0)

<?php
if(strcmp($title ,"About") ==0)
{?>
<img src="files/images/logo_wta_white.png" 
srcset ="files/images/logo_wta_white.png 1x, 
files /images/logo_wta_white@2x.png 2x" 
alt ="logo_wta_white">
<?php
} else {
?>
<img src="files/images/logo_wta.png" 
srcset ="files/images/logo_wta.png 1x, 
files /images/logo_wta@2x.png 2x" alt="logo_wta">
<?php
}
?>