爬虫 返回
-
Problem with: Fatal error: [] operator not supported for strings in Ask Question
-
You get this error when attempting to use the short array push syntax on a string.
For example, this
$foo = 'foo'; $foo[] = 'bar'; // ERROR!
I'd hazard a guess that one or more of your
$name
,$date
,$text
or$date2
variables has been initialised as a string.Edit: Looking again at your question, it looks like you don't actually want to use them as arrays as you're treating them as strings further down.
If so, change your assignments to
$name = $row['name']; $date = $row['date']; $text = $row['text']; $date2 = $row['date2'];
-