如何获取从 file_get_contents() 派生的内容的大小

Sas*_*wat 0 php mysql

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

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))."')
Run Code Online (Sandbox Code Playgroud)

现在的问题是,我如何获取 blob 元素的大小并将其存储在另一个字段中

假设 blob 大小为 5.34kb,我需要获取它并将其存储到另一个名为 blob_size 的字段中

小智 5

简单的方法 - 你可以使用strlen( file_get_contents($cover_image_src) )