草庐IT

format-security

全部标签

c# - PHP的number_format在C#中的等效功能是什么?

假设我有这些值:varupSize=365308443361.28;vardownSize=351897407979.52;varsize=upSize/downSize;在PHP中我可以这样做:number_format(size,3);输出将是:1.038如何在C#中使用string.Format()执行相同的操作? 最佳答案 是的,你可以使用string.Format:varupSize=365308443361.28;vardownSize=351897407979.52;varsize=upSize/downSize;st

php - 为什么使用 number_format() 会改变我的数值?

下面的代码给了我两个不同的输出:$number='1562798794365432135246';echo$number;echonumber_format($number);谁能解释一下?编辑:忘了说,上面给了我“15627987943654321352461,562,798,794,365,432,233,984”。请注意,最后六位数字完全不同,原因不明(我要求它做的只是插入千位分隔符)。 最佳答案 number_format(),asstatedbythePHPmanual,将一个float转换为一个带有逗号的数千组的字符串。

php - date_parse_from_format 到 unix 时间戳

我对date_parse_from_format()方法有疑问:$parsed=date_parse_from_format("YdMH:iT",'201228Nov21:00CET');Returnsassociativearraywithdetailedinfoaboutgivendate.这将返回一个包含一些日期信息的数组。但是有什么方法可以将它转换为unix时间戳吗? 最佳答案 约翰,下面是如何在您的场景中实现mktime的具体示例:$parsed=date_parse_from_format("YdMH:iT",'2012

php - Symfony2 安全 @Secure 注释不起作用

我正在尝试使用注解来保护我的Controller:namespaceVinny\StreamBundle\Controller;useSymfony\Bundle\FrameworkBundle\Controller\Controller;useJMS\SecurityExtraBundle\Annotation\Secure;useSensio\Bundle\FrameworkExtraBundle\Configuration\Route;classHomeControllerextendsController{/***@Route("/home",name="home")*@Sec

nacos2.2启动报错The specified key byte array is 16 bits which is not secure enough for any JWT HMAC-SHA

1.问题描述这几天搭建了一个微服务项目,使用nacos2.2来做注册和配置中心,但是启动nacos的时候发现报错,查看log后发现报的是,Causedby:io.jsonwebtoken.security.WeakKeyException:Thespecifiedkeybytearrayis16bitswhichisnotsecureenoughforanyJWTHMAC-SHAalgorithm. TheJWTJWASpecification(RFC7518,Section3.2)statesthatkeysusedwithHMAC-SHAalgorithmsMUSThaveasize>=2

PHP session.cookie_secure : Disables sessions when set to true

当我设置以下配置时:ini_set("session.cookie_secure",1);我的整个应用程序的session已禁用,我无法再写入或读取session变量。$sessionName="us";session_name($sessionName);ini_set('session.cookie_httponly',1);ini_set('session.entropy_file','/dev/urandom');ini_set('session.hash_function','whirlpool');ini_set('session.use_only_cookies',1);

php - 防止 number_format 舍入数字 - 添加逗号并保留小数点 - PHP

数字格式添加我想要的逗号但删除小数点。echonumber_format("1000000.25");返回1,000,000我希望它返回1,000,000.25我需要逗号和小数,没有任何数字舍入。我所有的值都是小数。它们的长度各不相同。我必须使用数字格式以外的格式吗? 最佳答案 如果您所说的它们的长度不同与小数部分有关,请看一下这段代码:functiongetLen($var){$tmp=explode('.',$var);if(count($tmp)>1){returnstrlen($tmp[1]);}}$var='1000000

php - 给出警告 : number_format() expects parameter 1 to be double, 字符串

关闭。这个问题需要debuggingdetails.它目前不接受答案。编辑问题以包含desiredbehavior,aspecificproblemorerror,andtheshortestcodenecessarytoreproducetheproblem.这将有助于其他人回答问题。关闭7年前。Improvethisquestion我的页面slider出现此错误:Warning:number_format()expectsparameter1tobedouble,stringgivenin/home/globalar/public_html/wp-content/themes/au

security - Symfony2 http_basic 安全拒绝有效凭据

我使用SymfonyStandard2.0.0BETA1并尝试配置与thisbookchapter中完全相同的http_basic身份验证security:encoders:Symfony\Component\Security\Core\User\User:plaintextproviders:main:users:foo:{password:testing,roles:ROLE_USER}firewalls:main:pattern:/.*http_basic:truelogout:trueaccess_control:-{path:/.*,role:ROLE_USER}问题是当我尝

php - 在 "security"代码拧紧后重置发布数据

我继承了一个古老而复杂的系统,该系统会及时更换,但现在我有一个主要问题。(加密的,耶!)初始化代码中的某处是与GPC变量混在一起的代码,应用诸如addslashes和htmlspecialchars之类的东西而不考虑任何类型的上下文.你知道的,绝对是小蛋糕会做的那种事情。不是您期望从有点昂贵的PHP软件中得到的东西。不管怎么说,有什么方法可以强制PHP重新读取请求的POST数据并从中重新填充$_POST吗?我已经尝试了gotogo-to方法file_get_contents("php://input");但返回空白-大概是init代码读取它,因为在旧版本的PHP中它只能读取一次....