小编علی*_*رضا的帖子

在php中将UTF-16LE转换为UTF-8

我使用iconvPHP函数,但有些字符无法正确转换:

...
$s = iconv('UTF-16', 'UTF-8', $s);
...
$s = iconv('UTF-16//IGNORE', 'UTF-8', $s);
...
$s = iconv('UTF-16LE', 'UTF-8', $s);
...
$s = iconv('UTF-16LE//IGNORE', 'UTF-8', $s);
...
Run Code Online (Sandbox Code Playgroud)

我也尝试mb_convert_encoding功能,但无法解决我的问题.

示例文本文件:9px.ir/utf8-16LE.rar

php encoding iconv

8
推荐指数
1
解决办法
3万
查看次数

如何在php项目中使用Piwik设备检测器?

我想使用php设备检测器,这是着名的Piwik项目的一部分,但我无法理解如何在我的PHP代码中包含和使用代码?我不想使用作曲家.

我写:

<?php
include 'DeviceDetector.php';
use DeviceDetector\DeviceDetector;
use DeviceDetector\Parser\Device\DeviceParserAbstract;

$dd = new DeviceDetector($_SERVER['HTTP_USER_AGENT']);

$dd->parse();

$clientInfo = $dd->getClient();
var_dump($clientInfo);
Run Code Online (Sandbox Code Playgroud)

但它不起作用.我收到此错误:

Fatal error:  Uncaught exception 'Exception' with message 'client parser not found' in D:\DeviceDetector.php:214
Stack trace:
#0 D:\DeviceDetector.php(136): DeviceDetector\DeviceDetector->addClientParser('FeedReader')
#1 D:\index.php(67): DeviceDetector\DeviceDetector->__construct('Mozilla/5.0 (Wi...')
#2 {main}
  thrown in D:\DeviceDetector.php on line 214
Run Code Online (Sandbox Code Playgroud)

php user-agent matomo

6
推荐指数
1
解决办法
2833
查看次数

AngularJS:将滚动事件绑定到一个控制器而不是全部

考虑我有100个控制器,我需要bind一个scroll事件给其中一个.

当控制器触发时,滚动事件监听器附加到文档并正常工作.但是当控制器改变时,滚动事件仍然存在并导致其他控制器出现问题!

我发现的唯一解决方案是所有其他99个控制器中unbindscroll事件,但它是愚蠢的!

angular.module('test', ['ngRoute'])
.config(function($routeProvider){
    $routeProvider
        .when('/c1', {controller:'c1', templateUrl:'/c1.html'})
        .when('/c2', {controller:'c2', templateUrl:'/c2.html'})
        ...
        .when('/c100', {controller:'c100', templateUrl:'/c100.html'})
        .otherwise({redirectTo: '/c1'});
})
.controller('c1', function($document){
    ...
    $document.bind('scroll', function(){...});
    ...
})
.controller('c2', function($document){
    $document.unbind('scroll');
    ...
})
...
.controller('c100', function($document){
    $document.unbind('scroll');
    ...
})
Run Code Online (Sandbox Code Playgroud)

什么是正确的方法?

scroll javascript-events angularjs

5
推荐指数
1
解决办法
3075
查看次数

ffmpeg 将音频文件流式传输到 Telegram rtmp 服务器

我尝试使用以下命令将 mp3 文件流式传输到 Telegram RTMP live:

ffmpeg -re -i 1.mp3 -c copy -f mp3 rtmps://dc4-1.rtmp.t.me/s/145158:AtyF3rrME2nHEkqGA
Run Code Online (Sandbox Code Playgroud)

但我在溪流中听不到任何声音。

ffmpeg rtmp telegram

0
推荐指数
1
解决办法
6280
查看次数