如何将文件内容作为textarea值?

test.php

<div class='btitle'>LOREM</div>

index.php

<?php $story = file_get_contents('test.php'); ?>
<textarea class='txa' value = <?php echo $story; ?>></textarea>

result
what I see inside textarea:

LOREM</div>
>

What's the problem?

do like this:-

<textarea class='txa'> <?php echo $story; ?> </textarea>

Just to show you why i have written in above way:

console.log($('textarea').val())
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<textarea class='txa'> 123 </textarea>

Note:- if $story has some markup - it could break html and probably you needs to use htmlspecialchars()

</div>

I do:

enter code here
   <?php $story = explode(PHP_EOL,file_get_contents('test.php'));foreach $story as $line) $text .= $line.'<br>'; ?>
enter code here

<textarea class='txa'> <?=$text ; ?> </textarea>