php excel library
i used PHP Excel writer pear package, but i got such errors
Deprecated: Assigning the return value of new by reference is deprecated in /usr/share/php/Spreadsheet/开发者_JS百科Excel/Writer/Workbook.php on line 180
this is outputted in the excel.
any ideas on how to solve this?
thanks in advance!
The meaning of the error message you're getting is that the code is using a PHP technique that is no longer recommended by PHP. It is deprecated, which means that they (the PHP developers) plan to remove the feature in a future version but have not yet done so, in order to allow older code to continue to run for the time being.
The feature in question is assigning the return value of a function with a by-ref value. In older versions of PHP (v4.x), there were several different ways to handle passing values by-reference; in recent versions of PHP (v5.x), they have standardised to a smaller sub-set of those methods, and deprecated the rest.
It is generally quite straightforward to convert code to use the currently-supported methods of passing by-ref. The fact that the code you're using hasn't been converted implies that it hasn't been updated in some time, which raises the question as to whether it's a good bit of code to be using - it may no longer be supported at all.
If you want to correct the code yourself, you'll need to understand how passing by reference works. That's too big a topic to explain here, but the PHP manual has a section on it which you can read: http://uk3.php.net/manual/en/language.references.php
You may also simply switch the error off - it is just a warning message, so your code will run fine without any changes. However the point of the message is to make you aware that the functionality may be removed at any time in a future update of PHP. There may come a time when you need to upgrade PHP, to get some other feature or fix, but the same upgrade will break this code. For the time being you can get away with it, but don't expect it to work in the long term.
The other (and probably better) solution would simply be to drop this package and try to find an alternative that is more up-to-date.
精彩评论