今天接手了一个项目(我以前没做过php),发现其index.php里很多变量没声明就直接拿来用了,如下foreach($leftresult as $left ){
$image1 = $left['imageurl'];
$img2 = explode("../",$image1);
$img3 = explode("_min",$img2[3]); <?$i=0;foreach($index_result as $index):$i++;?>
<?
$img = $index['imageurl'];
$str=explode("../",$img);
?>这个数组里是有东西的,但他没声明过,我不知道怎么回事。
$image1 = $left['imageurl'];
$img2 = explode("../",$image1);
$img3 = explode("_min",$img2[3]); <?$i=0;foreach($index_result as $index):$i++;?>
<?
$img = $index['imageurl'];
$str=explode("../",$img);
?>这个数组里是有东西的,但他没声明过,我不知道怎么回事。
PHP是弱类型语言,变量不需要声明就可以是任何类型的,变量随时定义,随时用!
搜索一下include关键字
require_once("partials/top.php");
require_once("partials/left.php");
require_once("application/modules/umc/register/register.php");
$StringCode = new StringCode();
?> 一开始有这么段,估计是些在这些文件里面了,我再去看看