doulongsha5478 2015-10-20 20:22
浏览 53
已采纳

如何使用DataTables jQuery插件从BD读取blob?

I try to read a blob field with DataTables Server-side processing but I can't. I suppose than I should transform to base64, but I don't know how it works.

$columns = array(
     array('db' =>'ID','dt'=>0),
     array('db'=>'LOGIN','dt'=>1),
     array('db'=>'IMG','dt'=>2)
);
$sql_details = array(
    'user' => 'x',
    'pass' => 'x',
    'db'   => 'x',
    'host' => 'x',
    'charset' => 'utf8'
);
require( 'scripts/ssp.class.php' );
echo json_encode(
    SSP::simple( $_POST, $sql_details, $table, $primaryKey, $columns)
);
  • 写回答

1条回答 默认 最新

  • dourang6423 2015-10-21 08:00
    关注

    I found the solution. Formatter allows write a function.

    $columns = array(
        array('db' =>'ID','dt'=>0),
        array('db'=>'LOGIN','dt'=>1),
        array(
           'db' => 'IMG',
           'dt' => 2,
           'formatter' => function($d, $row) {
            return base64_encode($d);
        })
    );
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 双层网络上信息-疾病传播
  • ¥50 paddlepaddle pinn
  • ¥20 idea运行测试代码报错问题
  • ¥15 网络监控:网络故障告警通知
  • ¥15 django项目运行报编码错误
  • ¥15 请问这个是什么意思?
  • ¥15 STM32驱动继电器
  • ¥15 Windows server update services
  • ¥15 关于#c语言#的问题:我现在在做一个墨水屏设计,2.9英寸的小屏怎么换4.2英寸大屏
  • ¥15 模糊pid与pid仿真结果几乎一样