كيف انتج كود iframe او Html باستخدام json_encode

السلام عليكم

لدي استفسار حول كود html

الفكرة انني اريد انتاج كود json يتضمن كود iframe ، استخدمت هذا الكود

$ezze = file_get_contents(__DIR__ . "/tokens/".$token.".txt");
$myJSONString = json_encode('<iframe src="'.$ezze.'" frameborder="0" allowFullScreen="true" webkitallowfullscreen="true" mozallowfullscreen="true" width="640" height="320"></iframe>');
echo  $myJSONString;

المشكل الذي يقع هو عند عرض رابط json يتم اظهار تنفيد الكود على شكل html وليس json ، يعني iframe يظهر على شكل فديو

وأنا اريد انتاج كود json للاستخدام في مكان اخر

يرجى الدخول لحسابك أو تسجيل حساب لتستطيع إضافة تعليق
حساب جديد دخول

التعليقات

Alwalid أضف ردا

فقط اضف كود Header

header('Content-Type: application/json');

قبل طباعة المتغيير $myJSONString لتعريف محتوي الصفحة علي انه JSON

ليكون الكود :

header('Content-Type: application/json');

$ezze = file_get_contents(__DIR__ . "/tokens/".$token.".txt");

$myJSONString = json_encode('<iframe src="'.$ezze.'" frameborder="0" allowFullScreen="true" webkitallowfullscreen="true" mozallowfullscreen="true" width="640" height="320"></iframe>');

echo $myJSONString;

Fnfnf
  • حذف بواسطة المستخدم