Strtr function actually appears catchable fatal error_php tutorial

Source: Internet
Author: User
Strtr function actually appears catchable fatal error

Error message:


Catchable fatal error:object of class variant could not being converted to string in d:wwwphpnowhtdocsxmlincxmlclass.php on Line 160

160 lines of code: return $tab 1.STRTR ($content, Array (' > ' = ' < ', ' < ' = ' + ' > ', ' & ' = ' & ', ' ' ' ' ' = ' ', ' ' ' "=");


Copy code 160 lines around code function encode ($content, $type = ' element ', $tab 1= ', $br = ') {if ($type = = ' Element ') {return $tab 1.STRTR ($ Content,array (' > ' = ' < ', ' < ' + ' > ', ' & ' = ' & ', ' ' ' ' + ', ' ', ' ' ', ' ' and ' ') '); }elseif ($type = = ' CDATA ') {return ', ']] > ', $content). $br. ']]> '; } }


Copy code has never come across.
I remember that this problem only occurs when the php+access is read.
I searched the Internet for 2 hours and found all the Chinese and English. I can't find a clue.


See the full code for the class:
[url=http://www.souzz.net/html/edu/php/php8/6590.html] link marker http://www.souzz.net/html/edu/php/php8/6590.html[/ Url

[ ]

I'll answer that.




d8888d Huitie Content-------------------------------------------------------
$content this is a class. It's not a string.

d8888d Huitie Content-------------------------------------------------------
Originally Posted by Tankme on 2009-3-5 22:26 [url=http://bbs.111cn.cn/redirect.php?goto=findpost&pid=894659&ptid=107280] Link marker [Img]http://bbs.111cn.cn/images/common/back.gif[/img][/url]
$content this is a class. It's not a string.
Can you make it a little more specific? I don't understand.

d8888d Huitie Content-------------------------------------------------------
It is clear from the error prompt that the object cannot be output directly to a string in php5, and if such a function is to be implemented, the __tostring () method is implemented in the object's base class.
That is, in the landlord's code $content is such an object


http://www.bkjia.com/PHPjc/632555.html www.bkjia.com true http://www.bkjia.com/PHPjc/632555.html techarticle strtr function unexpectedly appears catchable fatal error hint: catchable fatal Error:object of class variant could not being converted to Stri Ng in d:wwwphpnowhtdocsxmlincxmlclass.ph ...

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.