Php 如何获取从文件\u get\u contents()派生的内容的大小
我使用这种技术在mysql中将图像存储为blobPhp 如何获取从文件\u get\u contents()派生的内容的大小,php,mysql,Php,Mysql,我使用这种技术在mysql中将图像存储为blob INSERT INTO aw_offers_v2 ( id,name,description,payout_type, payout,expiration_date,creation_date,preview_url, tracking_url,categories,countries,c
INSERT INTO aw_offers_v2
(
id,name,description,payout_type,
payout,expiration_date,creation_date,preview_url,
tracking_url,categories,countries,countries_short,
api_key,network_id, icon)
VALUES
('$id','$name','$description','$payout_type',
'$payout','$expiration_time','$creation_time','$preview_url',
'$tracking_url','$categories','$countries','$countries_short',
'$api','$api_url','".mysql_real_escape_string(file_get_contents($cover_image_src))."')
现在的问题是,如何获得blob元素的大小并将其存储在另一个字段中
假设blob是5.34kb,我需要获取它并存储到另一个名为blob_size的字段中。假设内容位于URL
$cover_image_src
,您可以使用以下技术获取大小
$headers = get_headers($cover_image_src, 1);
$content_length = $headers["Content-Length"];
简单方法-您可以使用
strlen(文件获取内容($cover\u image\u src))