我有一个大的csv,我想解析并插入到我的数据库中.我有这个PHP:
$target = '../uploads/'.$f;
$handle = fopen($target, "r");
$data = fgetcsv($handle, 0, ",");
$rows = array();
while ($data !== FALSE) {
$rows[] = $data;
}
fclose($handle);
if (count($rows)) {
foreach ($rows as $key => $value) {
echo $value;
}
}
Run Code Online (Sandbox Code Playgroud)
每次我尝试运行我的脚本时都会收到此错误:
Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 35 bytes)
Run Code Online (Sandbox Code Playgroud)
任何想法如何做到这一点?
在下面的示例中,我收到一个错误,指出$foo->_test由于它是私有的,因此无法访问该值.我究竟做错了什么?
<?php
$foo = new Bar;
$foo->test();
print_r( $foo->_test );
class Foo
{
private $_test = array();
}
class Bar extends Foo
{
public function test()
{
$this->_test = 'opa';
}
}
?>
Run Code Online (Sandbox Code Playgroud)
任何帮助表示赞赏.
我正在创建自己的网站.我想知道我们是否可以在后台放置实时(移动)图片.
如果是的话,有人可以建议我一些好的网站,我可以从中了解如何使我的网站比其他网站更好吗?
先感谢您.