如何在php中的锚标签内插入alt标签?

    <div >
        <a href="<?=site_url()?>"><?=img('logo.png',array('class'=>'logo'))?></a>
    </div>

I want to add an ALT TAG for logo.png

thanks

If you are using code igniter framework you can do it like this

From The Codeigniter Documentation

$image_properties = array(
          'src' => 'images/picture.jpg',
          'alt' => 'Me, demonstrating how to eat 4 slices of pizza at one time',
          'class' => 'post_images',
          'width' => '200',
          'height' => '200',
          'title' => 'That was quite a night',
          'rel' => 'lightbox',
);

img($image_properties);

img()

Guess you are using some kind of framework, so the answer could not be correct. Please, try this:

<div>
    <a href="<?=site_url()?>"><?=img('logo.png', array('class'=>'logo', 'alt'=>'Write here your alternative text'))?></a>
</div>
  <div >
        <a title="your site" href="<?=site_url()?>"><?=img('logo.png',array('class'=>'logo'))?></a>
    </div>

You can not use alt attribute in anchor tag, instead use title attribute or , if it is an image as in your case it is a logo . You can use img tag and alt attribute.

may be something like with little bit modification.

<a href="<?=site_url()?>"><img src="<?=img('logo.png',array('class'=>'logo'))?>" alt="your site" /></a>

after looking your code,you might be used "codeigniter" framework and below is a solution for your code.below code is showing how to add a attribute in img function.you need to just pass an array,that contain a attribute and there value.

<div>
<a href="<?=site_url()?>">
<?= img(array('src'=>'image/logo.png', 
                    'alt'=> 'alt information',
                     'class'=>'logo')); ?>
</a>
</div>

please correct your syntax.