<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="mmres://user_interface_reference.css" rel="stylesheet" type="text/css">
<title>CFCOOKIE</title>
</head>
<body bgcolor="#FFFFFF" text="#000000">
   <div id="説明">
   <table cellpadding="0" cellspacing="0" border="0" width="100%" class="main">
      <tr> 
         <td valign="top" class="name">CFCOOKIE</td>
         <td valign="top" nowrap class="compatibility">&nbsp;</td>
      </tr>
      <tr>
         <td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
      </tr>


    </td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="description"><span class="title">説明</span>
<p>
有効期限、セキュリティオプションなどの Web ブラウザの Cookie 変数を定義します。 
</p>
    </td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="description"><span class="title">カテゴリ</span>
<p>
フォームタグ、変数操作タグ 
</p>
  <tr>
    <td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="syntax"><span class="title">シンタックス</span><pre>&lt;cfcookie
   name = &quot;cookie_name&quot;
   value = &quot;text&quot;
   expires = &quot;period&quot;
   secure = &quot;yes&quot;、&quot;no&quot;
   path = &quot;url&quot;
   domain = &quot;.domain&quot;&gt;
</pre>    </td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="description"><span class="title">関連項目</span>
<p>
cfdump、cfparam、cfregistry、cfsavecontent、cfschedule、cfset
</p>
    </td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="description"><span class="title">ヒストリ</span>
<p>
ColdFusion MX&#160;6.1: 
</p>
<ul>

<li>expires 属性が変更され、日付/時刻オブジェクトを受け入れるようになりました。</li>

<li>Cookie 名には、カンマ、セミコロン、空白文字を除くすべての ASCII 文字を含めることができます。</li>
</ul>

<p>

</p>
    </td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="description"><span class="title">使用方法</span>
<p>
このタグで、現在のブラウザセッションが終わっても Cookie が保存されるように指定した場合、クライアントブラウザによって Cookie がローカル Cookie ファイルに書き込まれるか更新されます。Cookie は、ブラウザが閉じられるまでブラウザメモリ内に残ります。expires 属性を指定しない場合、Cookie はブラウザの Cookie ファイルに書き込まれません。
</p>

<p>
ページ内で cfflush タグの後にこのタグを使用した場合、この Cookie はブラウザに送信されません。ただし、そのブラウザセッション中は、設定した値を Cookie スコープ内で使用することができます。
</p>
<table>
  <tr valign="top">
    <td width="30"><strong>メモ: </strong></td>
    <td>現在のブラウザセッションが無効になったときに無効になる Cookie を作成するには、cfset タグまたは CFScript の代入ステートメントを使用して Cookie スコープ内に変数を設定するという方法もあります (例 : &lt;cfset Cookie.mycookie=&quot;sugar&quot;&gt;)。Cookie の値を取得するには、Cookie スコープ内でその Cookie の名前を参照します (例 : &lt;cfif Cookie.mycookie is &quot;oatmeal&quot;&gt;)。</td>
  </tr>
</table>
<p>
次の例のように、Cookie 名にピリオド (.) を使用することができます。 
</p>
<pre>&lt;cfcookie name=&quot;person.name&quot; value=&quot;wilson, john&quot;&gt;
&lt;cfset cookie.person.lastname=&quot;Santiago&quot;&gt;
</pre>
<p>
自分が設定した Cookie でも、クライアントから送信された Cookie でも、Cookie にアクセスするには Cookie スコープを使用します。たとえば、先ほどの例で設定した person.name という Cookie の値を表示するには、次のようにします。
</p>
<pre>&lt;cfoutput&gt;#cookie.person.name#&lt;/cfoutput&gt;
</pre>    </td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="description"><span class="title">例</span><pre>&lt;!--- この例では、cfcookie 変数の設定および削除方法を示します。 ---&gt;
&lt;!--- サンプルデータベースにコメントを入力したユーザーを選択します。 ---&gt;
&lt;cfquery name = &quot;GetAolUser&quot; dataSource = &quot;cfdocexamples&quot;&gt;
   SELECT EMail, FromUser, Subject, Posted
   FROM Comments
&lt;/cfquery&gt;
&lt;html&gt;
&lt;body&gt;
&lt;h3&gt;cfcookie の例&lt;/h3&gt;
&lt;!--- URL 変数 delcookie が存在する場合は、Cookie の有効期限を NOW に設定します。 ---&gt;
&lt;cfif IsDefined(&quot;url.delcookie&quot;) is True&gt;
   &lt;cfcookie name = &quot;TimeVisited&quot;
   value = &quot;#Now()#&quot;
   expires = &quot;NOW&quot;&gt;      
&lt;cfelse&gt;
&lt;!--- それ以外の場合は、訪問者のリスト全体をループし、訪問者の電子メールアドレスで aol.com という文字列
に合致するものを見つけた場合に停止します。 ---&gt;
&lt;cfloop query = &quot;GetAolUser&quot;&gt;
   &lt;cfif FindNoCase(&quot;aol.com&quot;, Email, 1) is not 0&gt;
      &lt;cfcookie name = &quot;LastAOLVisitor&quot;
      value = &quot;#Email#&quot;
      expires = &quot;NOW&quot; &gt;      
   &lt;/cfif&gt;
&lt;/cfloop&gt;
&lt;!--- timeVisited Cookie が設定されていない場合は、値を設定します。 ---&gt;
   &lt;cfif IsDefined(&quot;Cookie.TimeVisited&quot;) is False&gt;
      &lt;cfcookie name = &quot;TimeVisited&quot;
      value = &quot;#Now()#&quot;
      expires = &quot;10&quot;&gt;
   &lt;/cfif&gt;
&lt;/cfif&gt;
&lt;!--- 最新の Cookie セットを表示します。 ---&gt;
&lt;cfif IsDefined(&quot;Cookie.LastAOLVisitor&quot;) is &quot;True&quot;&gt;
   &lt;p&gt;このサイトを表示した最後の AOL 訪問者 : 
   &lt;cfoutput&gt;#Cookie.LastAOLVisitor#&lt;/cfoutput&gt;、日付 : 
   &lt;cfoutput&gt;#DateFormat(COOKIE.TimeVisited)#&lt;/cfoutput&gt;
&lt;!--- このリンクを使用して Cookie をリセットします。 ---&gt;
&lt;p&gt;&lt;a href = &quot;cfcookie.cfm?delcookie = yes&quot;&gt;記録を隠す&lt;/A&gt;
&lt;cfelse&gt;
   &lt;p&gt;最近このサイトを訪問した AOL 訪問者はいません。
&lt;/cfif&gt;
</pre>
         </td>
      </tr>
   </table>
   </div>
<div id="NAME">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>  
<td valign="top" class="name">NAME</td>
  <td valign="top" nowrap class="compatibility">&nbsp;</td>
  </tr>
  <tr>
  <td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
  </tr>

  <tr>
  <td valign="top" class="syntax">&nbsp;</td>
  <td valign="top" nowrap class="requirements">必須</td>
  </tr>
  <tr>
  <td colspan="2" class="clearseparation">&nbsp;</td>
  </tr>
  <tr>
  <td valign="top" colspan="2" class="description">



<p>Cookie 変数の名前です。ColdFusion は Cookie 名をすべて大文字に変換します。このタグを使って設定する Cookie 名には、カンマ、セミコロン、空白文字を除くすべての印刷可能な ASCII 文字を含めることができます。</p>

  </td>
  </tr>
  </table>
</div>
<div id="VALUE">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>  
<td valign="top" class="name">VALUE</td>
  <td valign="top" nowrap class="compatibility">&nbsp;</td>
  </tr>
  <tr>
  <td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
  </tr>

  <tr>
  <td valign="top" class="syntax">&nbsp;</td>
  <td valign="top" nowrap class="requirements">オプション</td>
  </tr>
  <tr>
  <td colspan="2" class="clearseparation">&nbsp;</td>
  </tr>
  <tr>
  <td valign="top" colspan="2" class="description">



<p>Cookie 変数に割り当てる値です。文字列、または文字列として保管できる変数を指定する必要があります。</p>

  </td>
  </tr>
  </table>
</div>
<div id="EXPIRES">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>  
<td valign="top" class="name">EXPIRES</td>
  <td valign="top" nowrap class="compatibility">&nbsp;</td>
  </tr>
  <tr>
  <td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
  </tr>

  <tr>
  <td valign="top" class="syntax">&nbsp;</td>
  <td valign="top" nowrap class="requirements">オプション</td>
  </tr>
  <tr>
  <td colspan="2" class="clearseparation">&nbsp;</td>
  </tr>
  <tr>
  <td valign="top" colspan="2" class="description">



<p>Cookie 変数の有効期間です。 </p><ul>

<li>デフォルトでは、Cookie は、ユーザーがブラウザを閉じると無効になります。つまり、Cookie はセッションのみで有効です。</li>

<li>日付、または日付/時刻オブジェクト (例 : 10/09/97)</li>

<li>日数 (例 : 10、100)</li>

<li>now: クライアントの &quot;cookie.txt&quot; ファイルから Cookie を削除します (ただし、アクティブページの Cookie スコープ内の対応する変数は削除しません)。</li>

<li>never: Cookie は作成時刻から 30 年後に時間切れになります (Web 上の時間でいえば、実質的に無期限ということになります)。</li>
</ul>


  </td>
  </tr>
  </table>
</div>
<div id="SECURE">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>  
<td valign="top" class="name">SECURE</td>
  <td valign="top" nowrap class="compatibility">&nbsp;</td>
  </tr>
  <tr>
  <td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
  </tr>

  <tr>
  <td valign="top" class="syntax">&nbsp;</td>
  <td valign="top" nowrap class="requirements">オプション</td>
  </tr>
  <tr>
  <td colspan="2" class="clearseparation">&nbsp;</td>
  </tr>
  <tr>
  <td valign="top" colspan="2" class="description">



<p>ブラウザで SSL (Secure Socket Layer) がサポートされていない場合、Cookie は送信されません。Cookie を使用するには、https プロトコルを使ってページにアクセスする必要があります。 </p><ul>

<li>yes: 変数を安全に転送する必要があります。</li>

<li>no</li>
</ul>


  </td>
  </tr>
  </table>
</div>
<div id="PATH">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>  
<td valign="top" class="name">PATH</td>
  <td valign="top" nowrap class="compatibility">&nbsp;</td>
  </tr>
  <tr>
  <td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
  </tr>

  <tr>
  <td valign="top" class="syntax">&nbsp;</td>
  <td valign="top" nowrap class="requirements">オプション</td>
  </tr>
  <tr>
  <td colspan="2" class="clearseparation">&nbsp;</td>
  </tr>
  <tr>
  <td valign="top" colspan="2" class="description">



<p>この Cookie を適用するドメイン内の URL です。通常はディレクトリです。指定のパス内のページのみがこの Cookie を使用できます。デフォルトでは、Cookie を設定したサーバー上のすべてのページがその Cookie にアクセスできます。</p>
<p>path = &quot;/services/login&quot;</p>
<p>複数の URL を指定するには、複数の cfcookie タグを使用します。 </p>
<p>path を指定する場合は、domain 属性も指定する必要があります。 </p>

  </td>
  </tr>
  </table>
</div>
<div id="DOMAIN">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>  
<td valign="top" class="name">DOMAIN</td>
  <td valign="top" nowrap class="compatibility">&nbsp;</td>
  </tr>
  <tr>
  <td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
  </tr>

  <tr>
  <td valign="top" class="syntax">&nbsp;</td>
  <td valign="top" nowrap class="requirements">path 属性を指定している場合は必須</td>
  </tr>
  <tr>
  <td colspan="2" class="clearseparation">&nbsp;</td>
  </tr>
  <tr>
  <td valign="top" colspan="2" class="description">
  <tr>
  <td valign="top" class="syntax">&nbsp;</td>
  <td valign="top" nowrap class="requirements">それ以外の場合はオプション</td>
  </tr>
  <tr>
  <td colspan="2" class="clearseparation">&nbsp;</td>
  </tr>
  <tr>
  <td valign="top" colspan="2" class="description">



<p>Cookie が有効で、ユーザーのシステムから Cookie の内容を送信できるドメインを指定します。デフォルトでは、Cookie はそれを設定したサーバーでのみ使用できます。この属性を指定すると、Cookie を別のサーバーで使用できるようになります。</p>
<p>ピリオド (.) で始める必要があります。値がサブドメインの場合は、その文字列で終わるすべてのドメイン名が有効なドメインになります。この属性は、サイト上で Cookie を使用できる利用可能なサブドメインを設定します。</p>
<p>国コードで終わる domain 値の場合は、&quot;.mongo.state.us&quot; のように、3 つ以上のピリオドが含まれている必要があります。トップレベルドメインの場合は、&quot;.mgm.com&quot; のように、ピリオドは 2 つだけ必要です。 </p>
<p>IP アドレスをドメインとして使用することはできません。</p>

  </td>
  </tr>
  </table>
</div>

  </body>
</html>
