我想使用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) 如在图像中.对于某些值正确转换但有些值未转换...您可以在图像中看到
我想将数字转换为百万.我使用货币格式功能转换数字,但我无法转换数字.
这是控制器部分.对于某些数字,它转换为数百万,而对于某些数字,它没有转换..请有人帮忙.
$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) 保存文件时如何将文件更改从本地上传到远程服务器?
我想在按下ctrl+s快捷键时自动执行此操作,而不是手动执行。