Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

报错:Cannot access protected property Beanbun\Beanbun::$parser #1

Open
wangerzi opened this issue Sep 18, 2017 · 2 comments
Open

Comments

@wangerzi
Copy link

无法访问受保护的Beanbun的$parser,然后我在Beanbun.php里边修改$parser为公开就好了!^_^
public static $parser = null;

@kiddyuchina
Copy link
Owner

可能你是把 $parser 当作静态属性使用的?

$beanbun->parser;

上面这样写应该直接就可以用了

@wangerzi
Copy link
Author

不是我主动使用的,是执行的时候在beanbun-parser/src/Parser.php的第20行报的这个错误。
这是那里的代码片段:
`public function handle($beanbun)
{
$beanbun->parser = $this;

if ($this->auto) {
	$beanbun->data = [];
	$beanbun->afterDownloadPageHooks[] = [$this, 'parseData'];
	$beanbun->afterDiscoverHooks[] = [$this, 'cleanData'];
}

}`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants