共享服务器和 crypt 的问题

发布于 2024-12-02 19:59:24 字数 681 浏览 5 评论 0原文

不知道为什么,但在我的 VPS 服务器和本地 MacBook Pro 上。代码有效 但一旦我在共享的客户端服务器上使用它,我就会收到此错误。

<br />
<b>Notice</b>:  Undefined variable: njahhya in <b>/clientdata/zeus-dynamic-1/i/n/incard.com.au/www/telesales/system/classes/core.php</b> on line <b>13</b><br />
0<br />
<b>Notice</b>:  Undefined index:  task in <b>/clientdata/zeus-dynamic-1/i/n/incard.com.au/www/telesales/system/classes/core.php</b> on line <b>68</b><br />

我知道他们使用共享服务器,所以我并不感到惊讶,但我真的需要它才能工作,有什么解决办法吗?

$key = "$2a$07$ikuatfc$";
$this->password = crypt($password, $key);

Not sure why, but on my VPS server and my local MacBook Pro. The code works
but as soon as I use it on the clients server which is shared I get this error.

<br />
<b>Notice</b>:  Undefined variable: njahhya in <b>/clientdata/zeus-dynamic-1/i/n/incard.com.au/www/telesales/system/classes/core.php</b> on line <b>13</b><br />
0<br />
<b>Notice</b>:  Undefined index:  task in <b>/clientdata/zeus-dynamic-1/i/n/incard.com.au/www/telesales/system/classes/core.php</b> on line <b>68</b><br />

I know that they use a shared server, so I am not surprised but I really need it to work, is there any work around?

$key = "$2a$07$ikuatfc$";
$this->password = crypt($password, $key);

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

甚是思念 2024-12-09 19:59:24

我很确定第一个通知是 "$2a$07$ikuatfc$" 用双引号引起的。双引号中的变量是插值的:

$foo = 'bar';
echo "Hello $foo"; // Hello bar

"$2a$07$ikuatfc$" 充满了可能的变量名称。您应该将其写在单引号中以避免变量插值:'$2a$07$ikuatfc$'

更大的问题可能是在您的开发计算机上您有错误报告< /a> 关闭,而在生产服务器上错误报告默认打开。在开发期间打开错误报告,修复所有错误,在生产时关闭错误报告。

I'm pretty sure the first notice is the result of "$2a$07$ikuatfc$" being in double quotes. Variables in double quotes are interpolated:

$foo = 'bar';
echo "Hello $foo"; // Hello bar

"$2a$07$ikuatfc$" is full of possible variable names. You should write it in single quotes to avoid variable interpolation: '$2a$07$ikuatfc$'.

The larger issue is likely that on your development machines you have error reporting turned off, while on the production server error reporting is turned on by default. Turn on error reporting during development, fix all errors, turn error reporting off on production.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文