各位大侠好:           我是学习.NET的,但是最近迷上了PHP,由于是初学有几个初学者的问题想问下。请不要笑我是小白,在PHP中确实刚刚开始学习。           问题:网页都是以HTML语言编写之后才成了网页的布局的,为什么PHP文件里都没有HTML语言是怎么回事?           以下就是一个PHP文件:
<?php
/*
[UCenter Home] (C) 2007-2008 Comsenz Inc.
$Id: index.php 13003 2009-08-05 06:46:06Z liguode $
*/include_once('./common.php');if(is_numeric($_SERVER['QUERY_STRING'])) {
showmessage('enter_the_space', "space.php?uid=$_SERVER[QUERY_STRING]", 0);
}//二级域名
if(!isset($_GET['do']) && $_SCONFIG['allowdomain']) {
$hostarr = explode('.', $_SERVER['HTTP_HOST']);
$domainrootarr = explode('.', $_SCONFIG['domainroot']);
if(count($hostarr) > 2 && count($hostarr) > count($domainrootarr) && $hostarr[0] != 'www' && !isholddomain($hostarr[0])) {
showmessage('enter_the_space', $_SCONFIG['siteallurl'].'space.php?domain='.$hostarr[0], 0);
}
}if($_SGLOBAL['supe_uid']) {
//已登录,直接跳转个人首页
showmessage('enter_the_space', 'space.php?do=home', 0);
}if(empty($_SCONFIG['networkpublic'])) {

$cachefile = S_ROOT.'./data/cache_index.txt';
$cachetime = @filemtime($cachefile);

$spacelist = array();
if($_SGLOBAL['timestamp'] - $cachetime > 900) {
//20位热门用户
$query = $_SGLOBAL['db']->query("SELECT s.*, sf.resideprovince, sf.residecity
FROM ".tname('space')." s
LEFT JOIN ".tname('spacefield')." sf ON sf.uid=s.uid
ORDER BY s.friendnum DESC LIMIT 0,20");
while ($value = $_SGLOBAL['db']->fetch_array($query)) {
$spacelist[] = $value;
}
swritefile($cachefile, serialize($spacelist));
} else {
$spacelist = unserialize(sreadfile($cachefile));
}

//应用
$myappcount = 0;
$myapplist = array();
if($_SCONFIG['my_status']) {
$myappcount = $_SGLOBAL['db']->result($_SGLOBAL['db']->query("SELECT COUNT(*) FROM ".tname('myapp')." WHERE flag>='0'"), 0);
if($myappcount) {
$query = $_SGLOBAL['db']->query("SELECT appid,appname FROM ".tname('myapp')." WHERE flag>=0 ORDER BY flag DESC, displayorder LIMIT 0,7");
while ($value = $_SGLOBAL['db']->fetch_array($query)) {
$myapplist[] = $value;
}
}
}

//实名
foreach ($spacelist as $key => $value) {
realname_set($value['uid'], $value['username'], $value['name'], $value['namestatus']);
}
realname_get();

$_TPL['css'] = 'network';
include_once template("index");
} else {
include_once(S_ROOT.'./source/network.php');
}?> 
怎么都没有HTML代码啊?

解决方案 »

  1.   

    PHP 里面的定义变量,和函数等等,我都能明白,就是为什么都没有HTML代码区布局?不是很明白,谢谢
      

  2.   

    你的例子里面用到了模板,你可以从文件夹里把模板文件找出来看看。include_once('./common.php');
    $cachefile = S_ROOT.'./data/cache_index.txt';
     include_once template("index");
    include_once(S_ROOT.'./source/network.php');HTML都写在其他文件里了
      

  3.   

    include_once('./common.php'); 
    include_once(S_ROOT.'./source/network.php'); 
    这两个都没有HTML。
    include_once template("index"); 
    $cachefile = S_ROOT.'./data/cache_index.txt';
    这两个文件找不到
      

  4.   

    .net 不是也有代码与界面分离的吗?
      

  5.   

    问题是我都找不到PHP中那些HTML代码在什么地方
      

  6.   

    template("index"); 在这个文件里面呢
      

  7.   

    去include_once('./common.php');
    找 function template(..){........}没有的话common.php里面应该还有include,继续找,或者直接查找硬盘上内容包含"function template"的文件。
    又或者找找看有没有template或者templates之类的文件夹,有的话找里面的index.html或者index.tpl之类的文件。
      

  8.   

    php有后台代码吗? 比如象jsp和servlet可以结合使用.
      

  9.   

    这不是类似于.NET 的Code Behind的吗?
      

  10.   

    很明显在这一行.在之前echo下就找到了,当然最好是去找template函数的定义处看看.echo template("index");
    include_once template("index");
      

  11.   

    找到showmessage()这个函数,它里面的echo""中输出了HTML元素。
      

  12.   

    php最大的特色就是requair和include功能(单词可能拼错了哈,呵呵)都是包含调用已有的静态模板,所以你看到上面两个单词后面的文件一般是有的~