Home > database >  ob_get function make & to amp;
ob_get function make & to amp;

Time:03-18

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
    ]),
]);

After calling ob_get_clean(), it changes the & in the link to &. Is there any way to solve this problem?

CodePudding user response:

$test = '&';

echo htmlspecialchars(htmlspecialchars($test));
  • Related