Parse error: syntax error, unexpected '<', expecting T_STRING or T_VARIABLE or '{' or '$'
I am getting the above error in Code Igniter coding, mainly in line 2:
$this->load->model('helloworld_model');
$data['result'] = $this->helloworld_model-><span class="sql"> getData </span>();
$data['page_title'] = "CI Hello World App!";
$this->load->view('helloworld_view',$data);
Please help me to fix this.
Instead of
$data['result'] = $this->helloworld_model-><span class="sql"> getData </span>();
^
try
$data['result'] = $this->helloworld_model->getData();
Looks like some HTML made it into your PHP, probably while you copied and pasted it.
I assume you put the **
in there to mark the line this is about. If not, remove them as well.
$this->helloworld_model-><span class="sql"> getData </span>();
This is clearly wrong. Something has mangled your code, possibly something in your IDE.
Write:
$this->helloworld_model->getData();
BTW I see you've tried to use Markdown bold inside a code block; unfortunately you can't do that.
your PHP does not parse, the <
is unexpected. i'm not completely sure what kind of framework you are using here, but inserting a span directly into the PHP code will not work..
精彩评论