[帮助]为什么没有显示? [英] [HELP] Why No Display?

查看:66
本文介绍了[帮助]为什么没有显示?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,


我正在学习Gutmans,Bakken和他的PHP5 Power Programming回复并且来到了第58页。书中说输出是:


Judy

Joe


然而我从IE8和FF3都得不到任何结果相反!

我的机器是XP + PHP5 + Apache2.2。错误消息是:


可捕获的致命错误:类的对象无法在C中转换为字符串:\Program Files \ ... \ PHP5 PP\58 .php第24行


任何线索?


提前致谢,

-hide2may


//这是源:

Hi there,

I''m learning from PHP5 Power Programming by Gutmans, Bakken & Rethans and have come to p.58. The book says the output is:

Judy
Joe

However I get nothing from neither IE8 nor FF3 instead!
My machine is XP + PHP5 + Apache2.2. The error message is:

Catchable fatal error: Object of class Person could not be converted to string in C:\Program Files\...\PHP5 PP\58.php on line 24

Any clue?

Thanks in advance,
-hide2may

// Here is the source:

展开 | 选择 | Wrap | 行号

推荐答案

问题是
展开 | 选择 | Wrap | 行号


但是,您可以使用__toString()实现来执行此操作你在上面尝试了什么(虽然我认为这不是正确的方法)。

However, you can have a __toString() implementation that will allow you to do what you attempt above (although I don''t think it''s quite the right way to do it).

展开 | 选择 | 换行 | 行号


哦,不,Dormilich!即使我将相关代码更改为以下内容,仍然无法显示!怎么样?


......
Oh, no, Dormilich! Even I changed the relevant code to the followings, still get no display! How come?

...


这篇关于[帮助]为什么没有显示?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆