syntax error, unexpected '.' in PHP OOP

This question already has an answer here:

  • PHP parse/syntax errors; and how to solve them? 13 answers

  • "$dataSet->msg" is not a function but a property, and you need to call it like this.

    <a href='message.php?msg=".$dataSet->msg."'> // but wont work as it is private
    

    or use the method call as in the below line

    <a href='message.php?msg=".$dataSet->welcomeMessage()."'>
    

    Ok, let supoose that $dataSet is defined, and it has all required methods. Then you just need to omit the ; :

    echo "some text " . $dataSet->msg() . " more text";
    
    链接地址: http://www.djcxy.com/p/69460.html

    上一篇: 解析错误:语法错误,意外的'<'

    下一篇: 语法错误,意外的'。' 在PHP OOP中