小编Mah*_*diY的帖子

如何在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
查看次数

如何在javascript中将数字转换为百万

如在图像中.对于某些值正确转换但有些值未转换...您可以在图像中看到

我想将数字转换为百万.我使用货币格式功能转换数字,但我无法转换数字.

这是控制器部分.对于某些数字,它转换为数百万,而对于某些数字,它没有转换..请有人帮忙.

 $scope.MoneyFormat = function (labelValue) 
                    {
                          // Nine Zeroes for Billions
                          return Math.abs(Number(labelValue)) >= 1.0e+9

                               ? Math.abs(Number(labelValue)) / 1.0e+9 + "B"
                               // Six Zeroes for Millions 
                               : Math.abs(Number(labelValue)) >= 1.0e+6

                               ? Math.abs(Number(labelValue)) / 1.0e+6 + "M"
                               // Three Zeroes for Thousands
                               : Math.abs(Number(labelValue)) >= 1.0e+3

                               ? Math.abs(Number(labelValue)) / 1.0e+3 + "K"

                               : Math.abs(Number(labelValue));
                   }
Run Code Online (Sandbox Code Playgroud)

在这里,我使用Moneyformat转换数字.这是我转换数字的控制器部分

            $scope.rep.won = $scope.MoneyFormat($scope.rep.won);
            $scope.outlook.rem = $scope.MoneyFormat($scope.outlook.rem);
            $scope.rep.expectedAmount = $scope.MoneyFormat($scope.rep.expectedAmount);
            $scope.rep.potential = $scope.MoneyFormat($scope.rep.potential);
            $scope.rep.quota = $scope.MoneyFormat($scope.rep.quota);
Run Code Online (Sandbox Code Playgroud)

javascript

4
推荐指数
2
解决办法
9331
查看次数

在 PhpStorm 中按 ctrl + s 上传更改

保存文件时如何将文件更改从本地上传到远程服务器?

我想在按下ctrl+s快捷键时自动执行此操作,而不是手动执行。

remote-server phpstorm

2
推荐指数
1
解决办法
4868
查看次数

Qt - 从网址下载数据

我用PHP编写了一个Web服务.我需要通过Web服务URL下载内容.如何从URL下载数据?

需要哪些库?

qt qurl

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

标签 统计

javascript ×1

matomo ×1

php ×1

phpstorm ×1

qt ×1

qurl ×1

remote-server ×1

user-agent ×1