我有一个包含以下字段的表:
id (Unique)
url (Unique)
title
company
site_id
Run Code Online (Sandbox Code Playgroud)
现在,我需要删除具有相同的行title, company and site_id.一种方法是使用以下SQL和脚本(PHP):
SELECT title, site_id, location, id, count( * )
FROM jobs
GROUP BY site_id, company, title, location
HAVING count( * ) >1
Run Code Online (Sandbox Code Playgroud)
运行此查询后,我可以使用服务器端脚本删除重复项.
但是,我想知道是否只能使用SQL查询来完成.
我正在使用Php中的file()函数读取包含大约50k行的文件.但是,由于文件内容作为数组存储在内存中,因此会发出内存不足错误.还有其他方法吗?
而且,存储的行的长度是可变的.
这是代码.该文件也是700kB而不是mB.
private static function readScoreFile($scoreFile)
{
$file = file($scoreFile);
$relations = array();
for($i = 1; $i < count($file); $i++)
{
$relation = explode("\t",trim($file[$i]));
$relation = array(
'pwId_1' => $relation[0],
'pwId_2' => $relation[1],
'score' => $relation[2],
);
if($relation['score'] > 0)
{
$relations[] = $relation;
}
}
unset($file);
return $relations;
}
Run Code Online (Sandbox Code Playgroud) 我想在Web服务器(LAMP)上保存我的Flex应用程序的屏幕截图.这是Flex代码:
private function getBitmapData( target : UIComponent ) : BitmapData
{
var bd : BitmapData = new BitmapData( target.width, target.height );
var m : Matrix = new Matrix();
bd.draw( target, m );
return bd;
}
Run Code Online (Sandbox Code Playgroud)
现在,如何将此数据发送/接收到服务器?