php
1<?php 2 require_once('config.php'); 3 require_once('functions.php'); 4?> 5<!DOCTYPE html> 6<html lang="ja"> 7<head> 8 <meta charset="utf-8"> 9 <meta http-equiv="X-UA-Compatible" content="IE=edge"> 10 <meta name="viewport" content="width=device-width, initial-scale=1"> 11 <meta name="Description" content="example"> 12 <title>example</title> 13 <link rel="stylesheet" href="index.css"> 14 <!--[if lt IE 9]> 15 <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script> 16 <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script> 17 <![endif]--> 18</head> 19<body> 20 <h1>お問い合わせ</h1> 21</body> 22</html> 23
上記の**require_once('config.php');require_once('functions.php'); を消せば<h1>お問い合わせ</h1>**が表示されるのですが、**require_once('config.php');require_once('functions.php'); があるとgaaruto<h1>お問い合わせ</h1>**が表示されません。なぜですか?
config.php
php
1<?php 2 3 define('DSN','mysql:host=localhost;dbname=contacts_php'); 4 define('DB_USER','dbuser'); 5 define('DB_PASS','**********'); 6 7 define('SITE_URL','http://example.loc/contacts_php/'); 8 define('ADMIN_URL', SITE_URL.'admin/'); 9 10 error_reporting(E_ALL & ~E_NOTICE); 11 12 session_set_cookie_params(0,'/contacts_php/'); 13
functions.php
php
1<?php 2 function connectDB(){ 3 try{ 4 rerurn new PDO(DSN, DB_USER, DB_PASS); 5 }catch(PDOException $e){ 6 echo $e->getMessage(); 7 exit; 8 } 9 } 10 11 function h($s){ 12 return htmlspecialchars($s, ENT_QUOTES, "UTF-8"); 13 } 14
です。
あと、もう一つ質問なんですが、**session_set_cookie_params(0,'/contacts_php/');これの'/contacts_php/'**この部分はcontacts_php内でのみcookieを適用する。ということでいいですか?
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
退会済みユーザー
2015/07/26 07:43