需要更新已提交图像中的图像 ID 提取


Needs to update the image id extract from the submitted image?

我只需要帮助..

我正在处理图像库,管理员可以在其中上传具有单个类别 ID 的多个图像。图像采用这种格式,如"ABC_12345_business","ABC_23567_business"等,我已经成功地将多张图像上传到一个类别。但是我希望当我单击提交按钮时,图像将插入数据库,并在单独的行中更新图像ID[例如12345,23567]。这样我就可以轻松地按图像ID搜索图像。

你能解释一下我怎么做吗???

像这样处理每个图像:

$fileName = 'ABC_123456_bussiness';
$fileParts = explode('_', $fileName);
#Fileparts contains now:
#$fileParts[0] = 'ABC';
#$fileParts[1] = '123456';
#$fileParts[2] = 'bussiness';
insertIntoDB($fileParts);

这是你要找的东西吗?

嗯,

我不太确定你在找什么:

但是如果你想动态地做这件事,你可以在javascript-library jQuery的帮助下做一个AJAX请求。

但是,如果我要从霍尔格的轨道继续,我会在函数中进行爆炸,而不是像这样:

 function insertIntoDb(&$fileName){
  list($name, $id, $category) = explode("_",$fileName);
  //do shit here
}