index.phpの中でsample.phpを読み込んでいます。
その際、sample.phpのファイルは
①:アクセス禁止もしくはheaderでindex.phpに飛ばすなどの処理をするのが普通なのでしょうか。一般的な処理方法が知りたいです。そのままなのでしょうか。
②:読み込むファイルは最低限のhtmlタグ構成のみで問題ないのでしょうか。例えばmeta discriptionはなしにして、<title>..</title>の中は空白でも問題ないのでしょうか。
※<? require_once("sample.php"); ?>で必要な画像などは取得し、index.phpで表示できています。
PHP
1index.php 2 3<!DOCTYPE html> 4<html> 5 <head> 6 <meta charset="utf-8"> 7 <title></title> 8 </head> 9 <body> 10 <? include_once("sample.php"); ?> 11 </body> 12</html>
PHP
1sample.php 2<?... 3 4//データベース接続処理 5 6...?> 7 8 9<!DOCTYPE html> 10<html> 11 <head> 12 <meta charset="utf-8"> 13 <title></title> 14 </head> 15 <body> 16 17// 中身吐き出し 18<?php if (0 < count($rows)): ?> 19 <?php foreach ($rows as $row) : ?> 20<div class="sample-box"> 21<img stc="xxxxx/yyy/zzzz.jpg"> 22</div> 23 <?php endforeach; ?> 24 <?php endif; ?> 25 26 </body> 27</html> 28
回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
退会済みユーザー
2018/02/13 11:02
退会済みユーザー
2018/02/13 11:02