LMLPHP后院

使用php函数simplexml_load_string解析xml注意事项

较规则的 xml,程序员对字符的处理能力比较强的话,自己写一个解析器也未尝不可。大多数情况下,使用面向对象的库来解析 xml 是不太方便的,不如函数来的爽快。 使用函数 simplexml_load_string 的坑 文本讲述 PHP 函数 simplexml_load_string 解析 xml 的注意事项。对于提交比较小的 xml,使用此函数解析是再适合不过啦。关于此函数的坑,请看如下代码:<?php ...

Golang 学习笔记

true )常量 iotaconst a int = 1 // iota 使用在 const 括号内 const ( X = iota //0 Y //1 Z //2 )多返回值func f1(a string, b int) (int, int) { fmt.Println(a) fmt.Println(b) return 1, 2 } func f2(a string, b int) (x int, y...

图像处理技术之图片相似度比较

te * @param int $rate */ public function setErrorRate($rate){ self::$rate = $rate; } /** * * @param string $file * @throws Exception * @return multitype:Ambiguous <boolean, string, array> */ private static ...

再谈同名 Cookie 优先级问题

0547854; _gid=GA1.2.2119853286.1496442120 LBLOGUSS 在服务端 PHP 接收只有第一个:array(10) { ["UM_distinctid"]=> string(58) "15b0b9348e3d9-0e113a11eeb39a-317f0158-100200-15b0b9348e5d6" ["LBLOGUSS"]=> string(53) "2_14970...

使用PHP字符串处理mb系列函数注意事项

PHP 的 mbstring 系列函数在使用的时候需要设置内部编码,如果没有设置,则默认跟随系统编码。关于 mbstring 系列函数出现乱码问题,网上的很多被转载的文章大都说是没有安装 mbstring 扩展导致。如果没有安装 mbstring 扩展,报错的就是 Undefined function,而不是乱码的问题。很多程序在开发的时候,由于程序员的经验不够丰富,开始运行的时候没有任何问题,一旦迁移环境,...

Raspberry Pi 安装 Docker

$ docker Usage: docker [OPTIONS] COMMAND A self-sufficient runtime for containers Options: --config string Location of client config files (default "/home/pi/.docker") -c, --context string Name of the conte...

Java jdbc Mysql datetime 多个 .0

数据库字段为 datetime 类型,Java 中 Entity 使用 String 类型,选出的数据后面会包含 ".0",有人说是由于 MySQL datetime 是包含毫秒的。如下时间格式:2017-07-12 18:08:02.0一个不太文雅的解决方案,简单粗暴。public String getCreateTimeStr() { if (create_time == null) { return ...

[8192]stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in

stripos 使用报错记录。记录一个报错[8192]stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in解决办法PHP7.3版本影响 解决办法 1.换PHP版本 2. $nullOf...

springboot mybatis 多数据源配置

toryRef = "barSqlSessionFactory") public class MybatisBar { @Value("${bar.datasource.url}") private String url; @Value("${bar.datasource.username}") private String user; @Value("${bar.datasource.password}")...

PHP trim 函数引发崩溃且数据库保存失败

_dump(trim('血')); var_dump(trim('血', ' ')); var_dump(preg_replace('/^ | $/', '', ' 血 ')); return; 输出string(3) "血" string(2) "?" string(3) "血" 上面的例子是用来去除文字两边的中文全角空格,结果在个别字结尾的时候就出现来问号,这个特殊的编码的字符导致数据库保存失败,直接 c...
2024-04-25 15:16:32 1714029392 0.006101