删除“”从我的PHP字符串。 [英] Removing "" from my PHP strings.
问题描述
你好!
我需要帮助删除一个名为 BOM [ ^ ]。我很挣扎。
我到目前为止看到的所有Q&似乎都说这件事出现是因为代码被保存的编码,而我的BOM似乎在执行期间无处可见。
基本上,我有一个jquery ajax电话......
Hello!
I need some help removing a thing called the BOM[^] in my PHP code. I'm struggling.
All the Q&As I've seen so far seem to say that this thing appears because of the encoding in which code is saved, whereas my BOM seems to appear from nowhere during execution.
Basically, I have a jquery ajax call...
$.ajax({
type: "POST",
url: "php/session.php",
data: { name: a_name, password: a_password, company: a_company, q: "email" }
})
.done(function (msg) {
a_email = msg;
updatePersonals();
setTimeout(function () { slide("#Page7") }, waitback);
});
以及在session.php中q = email时执行的代码如下:
and the code executed if q=email in session.php is as follows:
//Just double check the creds. They've already been verified in a previous ajax call, when the company name "BoringWork" was passed to the client.
if (checkUser($name, $password)) {
$company = $_POST["company"];
//Have to come back to this.
//$datafile = '../../accounts/' . $company . '/' . $name . '/' . $CONST_account . '/email.txt';
$datafile = clean('../../accounts/' . $company . '/' . $name . '/' . $CONST_account . '/');
//NOTE 1
if (!file_exists($datafile)) {
mkdir($datafile, 0777, true);
}
$fp = fopen($datafile . 'email2.txt', 'w');
fwrite($fp, $rank);
fclose($fp);
die;
//This is what I want to run, but it doesn't work because
//somehow  gets appended to $company.
if (file_exists($datafile)) {
$contents = file_get_contents($datafile);
echo $contents;
} else {
echo ':-( Your information is corrupted.';
}
} else {
echo 'This_should_not_h@ppen.com';
}
现在如果一名成员被命名为虚构 Dude,并且在一家名为BoringWork的公司,然后我希望NOTE 1的代码生成一个../../accounts/Boring Work / Imaginary Dude /目录。
不幸的是,我收到了一个../../accounts/ïyes¿BoringWork/ Imaginary Dude /的文件夹。
我在die;之前得到了代码,因为我试图将用户的电子邮件传递给客户端,而这段代码似乎表明我收到了错误,因为不知怎的,这个我的研究的BOM到目前为止,我正在弄清楚我的文件路径。
所以有人知道这个BOM(又名)是什么,为什么我得到它?我被困了。
Now if a member was named "Imaginary Dude", and was at a company called "BoringWork", then I expect the code at "NOTE 1" to produce a directory of "../../accounts/Boring Work/Imaginary Dude/".
Unfortunately, I get an folder of "../../accounts/Boring Work/Imaginary Dude/".
I've got the code before the "die;" because I'm trying to pass the user's email to the client, and this code seems to reveal that I was getting errors because somehow this  thing, called a BOM by my research so far, is mucking up my filepath.
So does anyone know what this BOM (aka ) thing is, and why I'm getting it? I'm stuck.
推荐答案
.ajax({
type: POST,
url: php / session.php ,
数据:{name:a_name,密码:a_password,company:a_company,q: 电子邮件}
})
.done( function (msg){
a_email = msg;
updatePersonals();
setTimeout( function (){slide( #Page7)},waitback);
});
.ajax({ type: "POST", url: "php/session.php", data: { name: a_name, password: a_password, company: a_company, q: "email" } }) .done(function (msg) { a_email = msg; updatePersonals(); setTimeout(function () { slide("#Page7") }, waitback); });
和q =执行的代码session.php中的电子邮件如下:
and the code executed if q=email in session.php is as follows:
//Just double check the creds. They've already been verified in a previous ajax call, when the company name "BoringWork" was passed to the client.
if (checkUser(
name,
密码)){
password)) {
>
这篇关于删除“”从我的PHP字符串。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!