Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/263.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 如何获取从文件\u get\u contents()派生的内容的大小_Php_Mysql - Fatal编程技术网

Php 如何获取从文件\u get\u contents()派生的内容的大小

Php 如何获取从文件\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

我使用这种技术在mysql中将图像存储为blob

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))