PHP解析错误:语法错误,C:\ domain \xyz.com\wwwroot\123\index.php中的意外T_OBJECT_OPERATOR

时间:2022-07-17 22:31:27

I'm new to PHP and MySQL. When I run my files on the localhost, everything runs just perfect! But when I upload all files to live real domain I get this:

我是PHP和MySQL新手。当我在本地主机上运行文件时,一切都运行得非常完美!但当我上传所有文件到live real domain时,我得到了:

PHP Parse error: syntax error, unexpected T_OBJECT_OPERATOR in C:\Domains\xyz.com\wwwroot\123\index.php on line 26

PHP解析错误:语法错误,C:\ domain \xyz.com\wwwroot\123\index.php中的意外T_OBJECT_OPERATOR

This is line 26 in index.php:

这是index.php中的第26行:

GetApplication()->GetUserAuthorizationStrategy()->ApplyIdentityToConnectionOptions($result);

My web hosting provider has PHP and MySQL.

我的网络主机提供商有PHP和MySQL。

Any help is highly appreciated.

非常感谢您的帮助。

This is it:

就是这样:

function GetConnectionOptions()
{
    $result = GetGlobalConnectionOptions();
    $result['client_encoding'] = 'utf8';
    GetApplication()->GetUserAuthorizationStrategy()->ApplyIdentityToConnectionOptions($result);
    return $result;
}

2 个解决方案

#1


3  

This was introduced in PHP 5. Where ever you are deploying to really needs an update because it is running PHP 4.

这是在PHP 5中引入的。无论何时部署到哪里都需要更新,因为它正在运行PHP 4。

Test case:

测试用例:

<?php
class TestingClass
{
    function test()
    {
        return $this;
    }
}
function test()
{
    return new TestingClass();
}

test()->test();

PHP Lint v5.0.0:

PHP的棉絮v5.0.0:

C:\PHP500>php -l E:\testcase.php
No syntax errors detected in E:\testcase.php
C:\PHP500>php -v
PHP 5.0.0 (cgi-fcgi) (built: Jul 13 2004 21:39:41)

PHP Lint v4.4.9:

PHP的棉絮v4.4.9:

C:\PHP449>php -l E:\testcase.php
<br />
<b>Parse error</b>:  syntax error, unexpected T_OBJECT_OPERATOR in <b>E:\testcase.php</b> on line <b>16</b><br />
Errors parsing E:\testcase.php
C:\PHP449>php -v
PHP 4.4.9 (cgi-fcgi) (built: Aug  7 2008 15:04:24)

#2


0  

There is a space between - and >

在-和>之间有一个空格。

GetApplication()->GetUserAuthorizationStrategy()- >ApplyIdentityToConnectionOptions($result);

This means "minus greater than". Remove the space.

这意味着“减去大于”。删除空间。

2nd try: Is GetApplication really a function?

第二次尝试:GetApplication真的是一个函数吗?

#1


3  

This was introduced in PHP 5. Where ever you are deploying to really needs an update because it is running PHP 4.

这是在PHP 5中引入的。无论何时部署到哪里都需要更新,因为它正在运行PHP 4。

Test case:

测试用例:

<?php
class TestingClass
{
    function test()
    {
        return $this;
    }
}
function test()
{
    return new TestingClass();
}

test()->test();

PHP Lint v5.0.0:

PHP的棉絮v5.0.0:

C:\PHP500>php -l E:\testcase.php
No syntax errors detected in E:\testcase.php
C:\PHP500>php -v
PHP 5.0.0 (cgi-fcgi) (built: Jul 13 2004 21:39:41)

PHP Lint v4.4.9:

PHP的棉絮v4.4.9:

C:\PHP449>php -l E:\testcase.php
<br />
<b>Parse error</b>:  syntax error, unexpected T_OBJECT_OPERATOR in <b>E:\testcase.php</b> on line <b>16</b><br />
Errors parsing E:\testcase.php
C:\PHP449>php -v
PHP 4.4.9 (cgi-fcgi) (built: Aug  7 2008 15:04:24)

#2


0  

There is a space between - and >

在-和>之间有一个空格。

GetApplication()->GetUserAuthorizationStrategy()- >ApplyIdentityToConnectionOptions($result);

This means "minus greater than". Remove the space.

这意味着“减去大于”。删除空间。

2nd try: Is GetApplication really a function?

第二次尝试:GetApplication真的是一个函数吗?