求助:我做了一个"组合"模式的类,Men::Add()方法是往数组里加东西,然后Men::GetPlayInfo()调用,所有"数组"里的东西的GetPlayInfo(),但是 但是,用ie来检查的话,就出问题啊不相信,把代码下走,来test一下 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 <?php class Person { var $m_strItemName; function Person( $strItemName = "nothing" ) { $this ->m_strItemName; } function GetPlayInfo() { return $this ->m_strItemName; } } class Allen extends Person { function Tom( $strItemName ) { parent::Person( $strItemName ); } function GetPlayInfo() { echo "Allen now playing ".parent::GetPlayInfo(); } } class Steven extends Person { function Tom( $strItemName ) { parent::Person( $strItemName ); } function GetPlayInfo() { echo "Steven now playing ".parent::GetPlayInfo(); } } class Men extends Person { var $m_arrPerson = array(); function Men() { parent::Person(); } function Add( &$aPerson ) { array_push( $this->m_arrPerson, $aPerson ); } function GetPlayInfo() { $nCnt = count( $this ->m_arrPerson ); echo "<br/>","Member of club is ", $nCnt; for( $i = 0; $i < nCnt; $i++ ) { $this ->m_arrPerson[ $i ] ->GetPlayInfo(); } } }?><html> <title>Person Play</title> <body> <?php $allen = new Allen ( "basketball" ); $steven = new Steven( "football" ); $men = new Men(); $men ->Add( $allen ); $men ->Add( $steven ); $men ->GetPlayInfo(); ?> </body></html>少了个$this而已,呵呵,多不小心 function Add( &$aPerson ) { array_push( $this->m_arrPerson, $aPerson ); } 求一个php正则表达实现html转义,在线等 PHP数组按照概率返回的算法 php递归深度过大导致的问题 学PHP第三天,几个基础问题。 PHPmyadmin 点导出数据库 然后再导入到原来的位置 就变乱码了? 系统资源问题,高手请进! 高手求助,菜鸟问题! 一道位运算的小题 PHP的SESSION问题 表单提交问题:当设定form name时,php页面出错提示;当不设定form name时,一切正常。怎么解决? 请问php怎样连接interbase数据库呢? 在PHP中,怎样比较两个日期相距有多少天啊?
class Person
{
var $m_strItemName;
function Person( $strItemName = "nothing" )
{
$this ->m_strItemName;
} function GetPlayInfo()
{
return $this ->m_strItemName;
}
} class Allen extends Person
{
function Tom( $strItemName )
{
parent::Person( $strItemName );
} function GetPlayInfo()
{
echo "Allen now playing ".parent::GetPlayInfo();
}
} class Steven extends Person
{
function Tom( $strItemName )
{
parent::Person( $strItemName );
} function GetPlayInfo()
{
echo "Steven now playing ".parent::GetPlayInfo();
}
} class Men extends Person
{
var $m_arrPerson = array(); function Men()
{
parent::Person();
} function Add( &$aPerson )
{
array_push( $this->m_arrPerson, $aPerson );
} function GetPlayInfo()
{
$nCnt = count( $this ->m_arrPerson ); echo "<br/>","Member of club is ", $nCnt;
for( $i = 0; $i < nCnt; $i++ )
{
$this ->m_arrPerson[ $i ] ->GetPlayInfo();
}
}
}
?>
<html>
<title>Person Play</title>
<body>
<?php
$allen = new Allen ( "basketball" );
$steven = new Steven( "football" ); $men = new Men();
$men ->Add( $allen );
$men ->Add( $steven );
$men ->GetPlayInfo();
?>
</body>
</html>少了个$this而已,呵呵,多不小心
{
array_push( $this->m_arrPerson, $aPerson );
}