求助:我做了一个"组合"模式的类,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工作的前辈们我想找份php的工作不知道面试的时候应该做些什么 php ftp 问些新手的问题 求救:机器升级后php环境出现错误! 超简单的问题! photo123---请你近来啊 给足你100分!!!其他人暂时不要进来啊 在mysql中用select count()....查询到的数值 在php中能用什么函数取得? php实现简单的抽奖,有什么好方法? call_user_func有什么用 关于订餐系统的问题,PHP是如何调用订单机打印出订单? 请问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 );
}