ob_get 函数 make & to amp;
ob_get function make & to amp;
public function parseBlade($string, $param = null)
{
app(\Illuminate\Contracts\View\Factory::class)
->share('errors', app(\Illuminate\Support\MessageBag::class));
extract(app('view')->getShared(), EXTR_SKIP);
$__env->incrementRender();
if ($param) {
extract($param, EXTR_SKIP);
}
unset($param);
ob_start();
eval('?>' . app('blade.compiler')->compileString($string));
$content = ltrim(ob_get_clean());
$__env->decrementRender();
$__env->flushStateIfDoneRendering();
return $content;
}
$text = $template->content;
$data = array(
'token'=>$param['temporaryOrder']['token'],
'user'=>$param['isUseImei']);
$url = http_build_query($data,'','&');
$obj->setViewData([
'text' => $this->parseBlade($text,
[
'email' => $email,
'link' => config('frontend.ec_protocol') . $office->subdomain . config('frontend.ec_url') . '/order/registration?'. $url
]),
]);
调用ob_get_clean()
后,它会将link中的&
更改为&
。有什么办法可以解决这个问题吗?
$test = '&';
echo htmlspecialchars(htmlspecialchars($test));
public function parseBlade($string, $param = null)
{
app(\Illuminate\Contracts\View\Factory::class)
->share('errors', app(\Illuminate\Support\MessageBag::class));
extract(app('view')->getShared(), EXTR_SKIP);
$__env->incrementRender();
if ($param) {
extract($param, EXTR_SKIP);
}
unset($param);
ob_start();
eval('?>' . app('blade.compiler')->compileString($string));
$content = ltrim(ob_get_clean());
$__env->decrementRender();
$__env->flushStateIfDoneRendering();
return $content;
}
$text = $template->content;
$data = array(
'token'=>$param['temporaryOrder']['token'],
'user'=>$param['isUseImei']);
$url = http_build_query($data,'','&');
$obj->setViewData([
'text' => $this->parseBlade($text,
[
'email' => $email,
'link' => config('frontend.ec_protocol') . $office->subdomain . config('frontend.ec_url') . '/order/registration?'. $url
]),
]);
调用ob_get_clean()
后,它会将link中的&
更改为&
。有什么办法可以解决这个问题吗?
$test = '&';
echo htmlspecialchars(htmlspecialchars($test));