私は一日中、壊れたコードで私の髪を引っ張ってきました。私は早期に質問を投稿しましたが、問題を特定の問題に絞っています。PHPでbase64_decode()を使用した後に文字列変数を読み取ることができません
前の質問:Can't assess an array element after building array - a var_dump confirms element is there
は、今の問題は、base64デコード機能です。これは文字列を返すことを意図していますが、文字列を読み込もうとすると機能しません。
この単純なテストコードを見る
のerror_reporting(E_ALL);ここで
$encoded = base64_encode('my encrypted text');
$decoded = base64_decode($encoded, true);
echo "<br />";
printf('my encrypted text -> encoded to base64 = %s', $encoded);
echo "<br />";
printf('%s from base64 = %s', $endcoded, $decoded);
echo "<br />";
printf('calling $decoded to read string: result = %s', $decoded);
は結果である
my encrypted text -> encoded to base64 = bXkgZW5jcnlwdGVkIHRleHQ=
Notice: Undefined variable: endcoded in /home/website/base64test.php on line 10
from base64 = my encrypted text
calling $decoded to read string: result = my encrypted text
ライン10本である:
printf('%s from base64 = %s', $endcoded, $decoded);
は、これはバグですか?あるいは私は何かを逃している。
変数に格納された後に、base64_decode()関数から結果を読み取る方法を教えてください。
'S/endcoded/encoded' – Phil