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

标签 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))."')

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

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

最佳答案

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

关于php - 如何获取从 file_get_contents() 派生的内容的大小,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27100958/

相关文章:

php - 通过 Php 提供 .docx 文件

php - MySQL 网格 : daily sales vs region

php - 变量在某处为 "lost",然后重新出现......所有都没有抛出错误

java - 如何在 Hibernate 中获取 <map>

php - 如何编辑带有复选框的表单并在数据库端反射(reflect)更改

mysql - BLToolKit:如何获取 'empty' 日期时间字段?

mysql - 总分以前三名为准

php - Drupal 7 FAPI-在验证或提交处理程序中添加表单元素

php - Echo woocommerce 产品缩略图?

java - 我想在其中备份数据库的桌面应用程序系统