PHP code example of nsp-team / common-tools
1. Go to this page and download the library: Download nsp-team/common-tools library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
nsp-team / common-tools example snippets
MiniProgram::instance()
->setAccessToken('52_jW7tLxhmlcFqeiA_wDVC-CjcSAOAbAFADRD')
->ocr()
->idcard('https://xxx/65bee3c9-b972-4fb7-9dfe-9c4b9e7a8e.jpg');
var_dump(FileUtil::getExtension('/www/htdocs/inc/lib.inc.php'));
var_dump(FileUtil::getFilenameNoExtension('/www/htdocs/inc/lib.inc.php'));
var_dump(FileUtil::getFilenameWithExtension('/www/htdocs/inc/lib.inc.php'));
$arr = json_decode('{
"my_follower_count": "1",
"my_devices_count": "1",
"my_other_followers_count": 0,
"currentUser": {
"device_id": "77",
"actual_user_id": "283",
"auth_code": "22560",
},
"users": [{
"device_id": "77",
"actual_user_id": "283",
"birthday": "",
"auth_code": "22560",
}, {
"device_id": "72",
"actual_user_id": "269",
"birthday": "2021-11-26",
"auth_code": "0",
}]
}');
$collection = \NspTeam\Component\Tools\Collection::make($arr);
var_dump(\NspTeam\Component\Tools\Utils\ArrayUtil::camel($collection->toArray()));