简体   繁体   中英

IMG tag shows image in HTML but not in PHP

im making a php ebooksotre thing for my lass and i want to put an image but when i try it don't show up i run the file that have

<?php<div id="logo">
<img alt="logo" src="../images/logo.gif"
style="width: 200px; height:100px;" /> <h4>My e-Book Store</h4></div> ?>
It works like an HTML thing but when i put this code into main php file
<?php require_once('lib/bookstoreimg.php'); ?>
It show's a small thing(like when you type wrong name/ file dont exists) i tried 'bloginfo ('template_url'); and that does crazy things my container page and footer page disappears show exactly nothing not even the other thing not even the h4 tag (it was showing before) if you want i can send you my whole index.php so you can figure out what is going on exactly but i dont think something else affecting it .... i was trying to find out how to show code 我试图找出如何显示代码

You need to use 'echo' command to print anything on screen. To print your image on screen use:

<?php
echo'<div id="logo"><img alt="logo" src="../images/logo.gif" style="width: 200px; height:100px;" /> <h4>My e-Book Store</h4></div>'; ?>

PHP is made to dynamically show content. For example showing date. You can read more about PHP here: http://php.net/docs.php

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM