English 中文(简体)
PHP 探索无效性质
原标题:PHP explode on null character

I am trying to explode a string on what looks like to be a null character.

这就是我使用的:$exp = 考察(x00 ,bin);

虽然这并不奏效。 但是,如果我有<代码>exp = 考察($bin[5], bin);(此处为$bin)。 这是我想要探讨的这种性质。

If I do var_dump($bin[5]) It shows me square block with a question mark in it (), and in the view source I get: &amp;#0;

谁能告诉我,探讨这一特性的最佳方式是什么? 或者即便是无效性质(根据图表,除非我阅读所有错误,否则就是这样)。

增 编

最佳回答

引文:

$exp = explode("x00", $bin);

或者,采用等效的ASCII特性代码,并采用代谢法。

$char = ord($bin[5]);

// Replace this with the actual number returned from ord
$exp = explode(chr($char), $bin);

后一例排除了这样一种可能性,即如果你已经确定,它可能实际上不会无效。

问题回答

暂无回答




相关问题
Brute-force/DoS prevention in PHP [closed]

I am trying to write a script to prevent brute-force login attempts in a website I m building. The logic goes something like this: User sends login information. Check if username and password is ...

please can anyone check this while loop and if condition

<?php $con=mysql_connect("localhost","mts","mts"); if(!con) { die( unable to connect . mysql_error()); } mysql_select_db("mts",$con); /* date_default_timezone_set ("Asia/Calcutta"); $date = ...

定值美元

如何确认来自正确来源的数字。

Generating a drop down list of timezones with PHP

Most sites need some way to show the dates on the site in the users preferred timezone. Below are two lists that I found and then one method using the built in PHP DateTime class in PHP 5. I need ...

Text as watermarking in PHP

I want to create text as a watermark for an image. the water mark should have the following properties front: Impact color: white opacity: 31% Font style: regular, bold Bevel and Emboss size: 30 ...

How does php cast boolean variables?

How does php cast boolean variables? I was trying to save a boolean value to an array: $result["Users"]["is_login"] = true; but when I use debug the is_login value is blank. and when I do ...

热门标签