html (I want to include p-tags, h-tags, etc.) in variables

Asked 2 years ago, Updated 2 years ago, 42 views

I can't decide how to insert the syntax of html into the variables in the methods in the controller.

public function show(profile$profile){
$text="profile\n".
        "{$profile->name}\n".
        "Work\n".
        "{$profile->job}\n".
        US>"Skills\n".
        "{$profile->skill}\n".
        "Introduce yourself\n".
        "{$profile->introduction}";
return view('profile'=>$profile,);
}

I would like to substitute the following html syntax in the variable $text, but it does not work.
(I want to add style to h5, p, etc.)

<h5>Profile</h5>
<p>{$profile->name}</p>
<h6>Work</h6>
<p>{$profile->job}</p>
<h6>Skills</h6>
<p>{$profile->skill}</p>
<h6>Introduce yourself</h6>
<p>{$profile->introduction}</p>

$a="profile";
$text='<h5>'.$a.'</h5>';

<h5> is also spitting out as text.

I would appreciate it if someone could let me know.

php laravel

2022-09-30 14:20

1 Answers

I think you can do it if you write that

$text=<<EOM  
    US>"Profile\n".
    "{$profile->name}\n".
    "Work\n".
    "{$profile->job}\n".
    US>"Skills\n".
    "{$profile->skill}\n".
    "Introduce yourself\n".
    "{$profile->introduction}";
EOM;


2022-09-30 14:20

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.