【问题标题】:mysql_fetch_length equivalent function in CodeIgniter ?CodeIgniter 中的 mysql_fetch_length 等效函数?
【发布时间】:2014-05-24 12:04:36
【问题描述】:

我想计算一个数据库查询生成了多少个字符。 在 PHP 中,我使用mysql_fetch_length。 CodeIgniter 中是否有等价的功能?

【问题讨论】:

  • 首先停止使用/谈论mysql*家族

标签: codeigniter string-length


【解决方案1】:

“In Codeigniter”之于 php,就像“with jquery”之于 javascript,这些天来。这只是 php。

不,CI 没有这个。返回一个 row_array() 然后:

$row_array = ['test', 'this'];

$new_total = array_sum(array_map(function($value){$total = strlen($value);return $total;}, $row_array));
var_dump($new_total);

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-08-06
    • 2016-01-23
    • 1970-01-01
    • 2020-05-09
    • 2021-09-15
    • 1970-01-01
    相关资源
    最近更新 更多