<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>PHPプログラマのバリ・ポジ情報ブログ &#187; codeigniter</title>
	<atom:link href="http://blog.veryposi.info/tag/codeigniter/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.veryposi.info</link>
	<description>PHP,JavaScriptやサーバーの設定などのプログラミングに関する情報をバリ・ポジティブに発信しているプログラマのブログ、『バリ・ポジ』</description>
	<lastBuildDate>Thu, 10 May 2012 06:23:01 +0000</lastBuildDate>
	<language>ja</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>CodeIgniter2.Xでのmemcacheを使用する場合の方法</title>
		<link>http://blog.veryposi.info/programing/php/codeigniter2-memcached/</link>
		<comments>http://blog.veryposi.info/programing/php/codeigniter2-memcached/#comments</comments>
		<pubDate>Thu, 12 May 2011 02:51:47 +0000</pubDate>
		<dc:creator>gensan</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[codeigniter]]></category>
		<category><![CDATA[memcached]]></category>

		<guid isPermaLink="false">http://blog.veryposi.info/?p=1470</guid>
		<description><![CDATA[&#160;CodeIgniter2.Xになって新しくキャッシュドライバが追加されているので設定メモ &#160; application/config/memcached.phpを作成する 設定する項目は １．host [...]]]></description>
			<content:encoded><![CDATA[<p>&nbsp;CodeIgniter2.Xになって新しくキャッシュドライバが追加されているので設定メモ</p>
<p>&nbsp;</p>
<p>application/config/memcached.phpを作成する</p>
<p>設定する項目は</p>
<p>１．hostname</p>
<p>２．port</p>
<p>３．weight</p>
<p>もし上記が指定されていない場合は、以下のデフォルト値が使用される</p>
<p>hostname =&gt; &#8217;127.0.0.1&#8242;,</p>
<p>port =&gt; 11211,</p>
<p>weight =&gt; 1,</p>
<p>設定の例</p>
<div class="syntax">
<table>
<tbody>
<tr>
<td class="line_numbers">
<pre>
1
2
3
4
5
6
</pre>
</td>
<td class="code">
<pre class="php"><span style="color: #0000ff;">$config</span><span style="color: #66cc66;">[</span><span style="color: #ff0000;">'memcache01'</span><span style="color: #66cc66;">]</span><span style="color: #66cc66;">[</span><span style="color: #ff0000;">'hostname'</span><span style="color: #66cc66;">]</span> = <span style="color: #ff0000;">'192.168.1.101'</span>,
<span style="color: #0000ff;">$config</span><span style="color: #66cc66;">[</span><span style="color: #ff0000;">'memcache01'</span><span style="color: #66cc66;">]</span><span style="color: #66cc66;">[</span><span style="color: #ff0000;">'port'</span><span style="color: #66cc66;">]</span>     = <span style="color: #cc66cc;">11211</span>,
<span style="color: #0000ff;">$config</span><span style="color: #66cc66;">[</span><span style="color: #ff0000;">'memcache01'</span><span style="color: #66cc66;">]</span><span style="color: #66cc66;">[</span><span style="color: #ff0000;">'weight'</span><span style="color: #66cc66;">]</span>   = <span style="color: #cc66cc;">0</span>,
<span style="color: #0000ff;">$config</span><span style="color: #66cc66;">[</span><span style="color: #ff0000;">'memcache02'</span><span style="color: #66cc66;">]</span><span style="color: #66cc66;">[</span><span style="color: #ff0000;">'hostname'</span><span style="color: #66cc66;">]</span> = <span style="color: #ff0000;">'192.168.1.102'</span>,
<span style="color: #0000ff;">$config</span><span style="color: #66cc66;">[</span><span style="color: #ff0000;">'memcache02'</span><span style="color: #66cc66;">]</span><span style="color: #66cc66;">[</span><span style="color: #ff0000;">'port'</span><span style="color: #66cc66;">]</span>     = <span style="color: #cc66cc;">11211</span>,
<span style="color: #0000ff;">$config</span><span style="color: #66cc66;">[</span><span style="color: #ff0000;">'memcache02'</span><span style="color: #66cc66;">]</span><span style="color: #66cc66;">[</span><span style="color: #ff0000;">'weight'</span><span style="color: #66cc66;">]</span>   = <span style="color: #cc66cc;">0</span>,</pre>
</td>
</tr>
</tbody>
</table>
</div>
<p>ちなみに、</p>
<p>Memcached::OPT_LIBKETAMA_COMPATIBLE</p>
<p>これを設定しておかないとサーバー台数の増減があった場合に、今までのキャッシュが有効的に使用されない。</p>
<p>このライブラリの中では何もオプションは設定されていないので、必要に応じて個人で設定する必要がある。</p>
<p>が・・・設定方法がないな・・・。</p>
<div>&nbsp;</div>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.veryposi.info/programing/php/codeigniter2-memcached/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CodeIgniterでのCLI</title>
		<link>http://blog.veryposi.info/programing/php/codeigniter-cli/</link>
		<comments>http://blog.veryposi.info/programing/php/codeigniter-cli/#comments</comments>
		<pubDate>Thu, 07 Apr 2011 01:33:45 +0000</pubDate>
		<dc:creator>gensan</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[codeigniter]]></category>

		<guid isPermaLink="false">http://blog.veryposi.info/?p=1454</guid>
		<description><![CDATA[CodeIgniterで2.0から、CLIで使用できるようになっていたらしい。 初めてしった・・・。 参考に教えていただいたURLです。 http://fukata.org/2011/01/29/codeigniter2 [...]]]></description>
			<content:encoded><![CDATA[<p>CodeIgniterで2.0から、CLIで使用できるようになっていたらしい。</p>
<p>初めてしった・・・。</p>
<p>参考に教えていただいたURLです。</p>
<p><a href="http://fukata.org/2011/01/29/codeigniter2-use-commandline/">http://fukata.org/2011/01/29/codeigniter2-use-commandline/&nbsp;</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.veryposi.info/programing/php/codeigniter-cli/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CodeIgniterにmemcacheをsession使用するライブラリを作成しました</title>
		<link>http://blog.veryposi.info/programing/php/codeigniter-memcache-session-php/</link>
		<comments>http://blog.veryposi.info/programing/php/codeigniter-memcache-session-php/#comments</comments>
		<pubDate>Fri, 05 Jun 2009 09:08:37 +0000</pubDate>
		<dc:creator>gensan</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[codeigniter]]></category>

		<guid isPermaLink="false">http://blog.veryposi.info/?p=1285</guid>
		<description><![CDATA[PHPのセッション管理にmemcacheを使用しようとしていて複数台のサーバーでmemcacheを利用しようとした場合に php.iniの設定だけではどうやってもできなかった・・・。（本当は出来るのかもしれないのだけど・ [...]]]></description>
			<content:encoded><![CDATA[<p><span style="color: rgb(255, 102, 0);"><span style="font-size: large;">P</span></span>HPのセッション管理にmemcacheを使用しようとしていて複数台のサーバーでmemcacheを利用しようとした場合に</p>
<p>php.iniの設定だけではどうやってもできなかった・・・。（本当は出来るのかもしれないのだけど・・・<img src="http://blog.veryposi.info/wp-content/plugins/fckeditor-for-wordpress-plugin/smiles/typepad/sweat02.gif" alt="" />）</p>
<p>&nbsp;</p>
<p>なので、ライブラリを作成しました。</p>
<p>今回はCodeIgniter用のライブラリです。</p>
<p>よかったら使ってみてください。</p>
<div class="syntax">
<table>
<tbody>
<tr>
<td class="line_numbers">
<pre>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
</pre>
</td>
<td class="code">
<pre class="php"><span style="color: rgb(0, 0, 0); font-weight: bold;">&lt;?php</span>  <span style="color: rgb(177, 177, 0);">if</span> <span style="color: rgb(102, 204, 102);">(</span> ! <a href="http://www.php.net/defined"><span style="color: rgb(0, 0, 102);">defined</span></a><span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(255, 0, 0);">'BASEPATH'</span><span style="color: rgb(102, 204, 102);">)</span><span style="color: rgb(102, 204, 102);">)</span> <a href="http://www.php.net/exit"><span style="color: rgb(0, 0, 102);">exit</span></a><span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(255, 0, 0);">'No direct script access allowed'</span><span style="color: rgb(102, 204, 102);">)</span>;
<span style="color: rgb(128, 128, 128); font-style: italic;">/**
 *
 * memcacheを利用したsessionライブラリ
 *
 * memcacheを利用したsession管理処理を行う
 *
 * @access public
 * @varsion 1.00
 * @sinse 2009/06/03
 */</span>
<span style="color: rgb(0, 0, 0); font-weight: bold;">class</span> Memsession <span style="color: rgb(102, 204, 102);">{</span>
&nbsp;
  <span style="color: rgb(128, 128, 128); font-style: italic;">/**
   * CodeIgniterインスタンス
   */</span>
  <span style="color: rgb(0, 0, 0); font-weight: bold;">var</span> <span style="color: rgb(0, 0, 255);">$CI</span> = <span style="color: rgb(0, 0, 0); font-weight: bold;">null</span>;
&nbsp;
  <span style="color: rgb(128, 128, 128); font-style: italic;">/**
   * memcacheインスタンス
   */</span>
  <span style="color: rgb(0, 0, 0); font-weight: bold;">var</span> <span style="color: rgb(0, 0, 255);">$memcache</span> = <span style="color: rgb(0, 0, 0); font-weight: bold;">null</span>;
&nbsp;
  <span style="color: rgb(128, 128, 128); font-style: italic;">/**
   * セッションキー
   */</span>
   <span style="color: rgb(0, 0, 0); font-weight: bold;">var</span> <span style="color: rgb(0, 0, 255);">$key</span> = <span style="color: rgb(255, 0, 0);">'memsess_'</span>;
&nbsp;
  <span style="color: rgb(128, 128, 128); font-style: italic;">/**
   * configファイル名
   */</span>
   <span style="color: rgb(0, 0, 0); font-weight: bold;">var</span> <span style="color: rgb(0, 0, 255);">$conf_name</span> = <span style="color: rgb(255, 0, 0);">'memcache_config'</span>;
&nbsp;
  <span style="color: rgb(128, 128, 128); font-style: italic;">/**
   *
   * コンストラクタ
   *
   * @access public
   * @return void
   */</span>
  <span style="color: rgb(0, 0, 0); font-weight: bold;">function</span> __construct<span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(102, 204, 102);">)</span>
  <span style="color: rgb(102, 204, 102);">{</span>
    <span style="color: rgb(0, 0, 255);">$this</span>-&gt;<span style="color: rgb(0, 102, 0);">CI</span> = &amp; get_instance<span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(102, 204, 102);">)</span>;
    <span style="color: rgb(0, 0, 255);">$this</span>-&gt;<span style="color: rgb(0, 102, 0);">CI</span>-&gt;<span style="color: rgb(0, 102, 0);">config</span>-&gt;<span style="color: rgb(0, 102, 0);">load</span><span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(0, 0, 255);">$this</span>-&gt;<span style="color: rgb(0, 102, 0);">conf_name</span>,<span style="color: rgb(0, 0, 0); font-weight: bold;">true</span>,<span style="color: rgb(0, 0, 0); font-weight: bold;">true</span><span style="color: rgb(102, 204, 102);">)</span>;
    <span style="color: rgb(0, 0, 255);">$this</span>-&gt;<span style="color: rgb(0, 102, 0);">init_cache</span><span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(102, 204, 102);">)</span>;
    <a href="http://www.php.net/session_set_save_handler"><span style="color: rgb(0, 0, 102);">session_set_save_handler</span></a><span style="color: rgb(102, 204, 102);">(</span>
      <a href="http://www.php.net/array"><span style="color: rgb(0, 0, 102);">array</span></a><span style="color: rgb(102, 204, 102);">(</span>&amp; <span style="color: rgb(0, 0, 255);">$this</span>, <span style="color: rgb(255, 0, 0);">&quot;open&quot;</span><span style="color: rgb(102, 204, 102);">)</span>,
      <a href="http://www.php.net/array"><span style="color: rgb(0, 0, 102);">array</span></a><span style="color: rgb(102, 204, 102);">(</span>&amp; <span style="color: rgb(0, 0, 255);">$this</span>, <span style="color: rgb(255, 0, 0);">&quot;close&quot;</span><span style="color: rgb(102, 204, 102);">)</span>,
      <a href="http://www.php.net/array"><span style="color: rgb(0, 0, 102);">array</span></a><span style="color: rgb(102, 204, 102);">(</span>&amp; <span style="color: rgb(0, 0, 255);">$this</span>, <span style="color: rgb(255, 0, 0);">&quot;read&quot;</span><span style="color: rgb(102, 204, 102);">)</span>,
      <a href="http://www.php.net/array"><span style="color: rgb(0, 0, 102);">array</span></a><span style="color: rgb(102, 204, 102);">(</span>&amp; <span style="color: rgb(0, 0, 255);">$this</span>, <span style="color: rgb(255, 0, 0);">&quot;write&quot;</span><span style="color: rgb(102, 204, 102);">)</span>,
      <a href="http://www.php.net/array"><span style="color: rgb(0, 0, 102);">array</span></a><span style="color: rgb(102, 204, 102);">(</span>&amp; <span style="color: rgb(0, 0, 255);">$this</span>, <span style="color: rgb(255, 0, 0);">&quot;destroy&quot;</span><span style="color: rgb(102, 204, 102);">)</span>,
      <a href="http://www.php.net/array"><span style="color: rgb(0, 0, 102);">array</span></a><span style="color: rgb(102, 204, 102);">(</span>&amp; <span style="color: rgb(0, 0, 255);">$this</span>, <span style="color: rgb(255, 0, 0);">&quot;gc&quot;</span><span style="color: rgb(102, 204, 102);">)</span>
    <span style="color: rgb(102, 204, 102);">)</span>;
    <a href="http://www.php.net/session_start"><span style="color: rgb(0, 0, 102);">session_start</span></a><span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(102, 204, 102);">)</span>;
  <span style="color: rgb(102, 204, 102);">}</span>
&nbsp;
  <span style="color: rgb(128, 128, 128); font-style: italic;">/**
   *
   * memcache初期化処理
   *
   */</span>
  <span style="color: rgb(0, 0, 0); font-weight: bold;">function</span> init_cache<span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(102, 204, 102);">)</span>
  <span style="color: rgb(102, 204, 102);">{</span>
    <span style="color: rgb(177, 177, 0);">if</span> <span style="color: rgb(102, 204, 102);">(</span>!<a href="http://www.php.net/isset"><span style="color: rgb(0, 0, 102);">isset</span></a><span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(0, 0, 255);">$this</span>-&gt;<span style="color: rgb(0, 102, 0);">memcache</span><span style="color: rgb(102, 204, 102);">)</span><span style="color: rgb(102, 204, 102);">)</span> <span style="color: rgb(102, 204, 102);">{</span>
      <span style="color: rgb(0, 0, 255);">$ret</span> = <span style="color: rgb(0, 0, 0); font-weight: bold;">false</span>;
      <span style="color: rgb(0, 0, 255);">$servers</span> = <span style="color: rgb(0, 0, 255);">$this</span>-&gt;<span style="color: rgb(0, 102, 0);">CI</span>-&gt;<span style="color: rgb(0, 102, 0);">config</span>-&gt;<span style="color: rgb(0, 102, 0);">item</span><span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(255, 0, 0);">'servers'</span>, <span style="color: rgb(0, 0, 255);">$this</span>-&gt;<span style="color: rgb(0, 102, 0);">conf_name</span><span style="color: rgb(102, 204, 102);">)</span>;
      <span style="color: rgb(0, 0, 255);">$this</span>-&gt;<span style="color: rgb(0, 102, 0);">memcache</span> =&amp; <span style="color: rgb(0, 0, 0); font-weight: bold;">new</span> Memcache<span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(102, 204, 102);">)</span>;
      <span style="color: rgb(177, 177, 0);">foreach</span> <span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(0, 0, 255);">$servers</span> <span style="color: rgb(177, 177, 0);">as</span> <span style="color: rgb(0, 0, 255);">$server</span><span style="color: rgb(102, 204, 102);">)</span> <span style="color: rgb(102, 204, 102);">{</span>
        <span style="color: rgb(0, 0, 255);">$parts</span> = <a href="http://www.php.net/explode"><span style="color: rgb(0, 0, 102);">explode</span></a><span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(255, 0, 0);">':'</span>, <span style="color: rgb(0, 0, 255);">$server</span><span style="color: rgb(102, 204, 102);">)</span>;
        <span style="color: rgb(0, 0, 255);">$host</span>  = <span style="color: rgb(0, 0, 255);">$parts</span><span style="color: rgb(102, 204, 102);">[</span><span style="color: rgb(204, 102, 204);">0</span><span style="color: rgb(102, 204, 102);">]</span>;
        <span style="color: rgb(0, 0, 255);">$port</span>  = <span style="color: rgb(204, 102, 204);">11211</span>;
        <span style="color: rgb(177, 177, 0);">if</span> <span style="color: rgb(102, 204, 102);">(</span><a href="http://www.php.net/isset"><span style="color: rgb(0, 0, 102);">isset</span></a><span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(0, 0, 255);">$parts</span><span style="color: rgb(102, 204, 102);">[</span><span style="color: rgb(204, 102, 204);">1</span><span style="color: rgb(102, 204, 102);">]</span><span style="color: rgb(102, 204, 102);">)</span><span style="color: rgb(102, 204, 102);">)</span> <span style="color: rgb(102, 204, 102);">{</span>
          <span style="color: rgb(0, 0, 255);">$port</span> = <span style="color: rgb(0, 0, 255);">$parts</span><span style="color: rgb(102, 204, 102);">[</span><span style="color: rgb(204, 102, 204);">1</span><span style="color: rgb(102, 204, 102);">]</span>;
        <span style="color: rgb(102, 204, 102);">}</span>
        <span style="color: rgb(177, 177, 0);">if</span> <span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(0, 0, 255);">$this</span>-&gt;<span style="color: rgb(0, 102, 0);">memcache</span>-&gt;<span style="color: rgb(0, 102, 0);">addServer</span><span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(0, 0, 255);">$host</span>, <span style="color: rgb(0, 0, 255);">$port</span><span style="color: rgb(102, 204, 102);">)</span><span style="color: rgb(102, 204, 102);">)</span> <span style="color: rgb(102, 204, 102);">{</span>
          <span style="color: rgb(0, 0, 255);">$ret</span> = <span style="color: rgb(0, 0, 0); font-weight: bold;">true</span>;
        <span style="color: rgb(102, 204, 102);">}</span>
      <span style="color: rgb(102, 204, 102);">}</span>
      <span style="color: rgb(177, 177, 0);">return</span> <span style="color: rgb(0, 0, 255);">$ret</span>;
    <span style="color: rgb(102, 204, 102);">}</span>
    <span style="color: rgb(177, 177, 0);">return</span> <span style="color: rgb(0, 0, 0); font-weight: bold;">true</span>;
  <span style="color: rgb(102, 204, 102);">}</span>
&nbsp;
  <span style="color: rgb(128, 128, 128); font-style: italic;">/**
   *
   * open 関数
   *
   * @param string 保存パス
   * @param string セッション名
   * @return bool
   */</span>
  <span style="color: rgb(0, 0, 0); font-weight: bold;">function</span> open<span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(0, 0, 255);">$save_path</span>, <span style="color: rgb(0, 0, 255);">$session_name</span><span style="color: rgb(102, 204, 102);">)</span>
  <span style="color: rgb(102, 204, 102);">{</span>
    <span style="color: rgb(0, 0, 255);">$this</span>-&gt;<span style="color: rgb(0, 102, 0);">session_path</span> = <span style="color: rgb(0, 0, 255);">$save_path</span>;
    <span style="color: rgb(0, 0, 255);">$this</span>-&gt;<span style="color: rgb(0, 102, 0);">session_name</span> = <span style="color: rgb(0, 0, 255);">$session_name</span>;
    <span style="color: rgb(177, 177, 0);">return</span> <span style="color: rgb(0, 0, 0); font-weight: bold;">true</span>;
  <span style="color: rgb(102, 204, 102);">}</span>
&nbsp;
  <span style="color: rgb(128, 128, 128); font-style: italic;">/**
   *
   * close 関数
   *
   * @return bool
   */</span>
  <span style="color: rgb(0, 0, 0); font-weight: bold;">function</span> close<span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(102, 204, 102);">)</span>
  <span style="color: rgb(102, 204, 102);">{</span>
    <span style="color: rgb(177, 177, 0);">return</span> <span style="color: rgb(0, 0, 0); font-weight: bold;">true</span>;
  <span style="color: rgb(102, 204, 102);">}</span>
&nbsp;
  <span style="color: rgb(128, 128, 128); font-style: italic;">/**
   *
   * read 関数
   *
   * @param string セッションID
   * @return string
   */</span>
  <span style="color: rgb(0, 0, 0); font-weight: bold;">function</span> read<span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(0, 0, 255);">$id</span><span style="color: rgb(102, 204, 102);">)</span>
  <span style="color: rgb(102, 204, 102);">{</span>
    <span style="color: rgb(177, 177, 0);">if</span> <span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(0, 0, 255);">$sess_data</span> = <span style="color: rgb(0, 0, 255);">$this</span>-&gt;<span style="color: rgb(0, 102, 0);">memcache</span>-&gt;<span style="color: rgb(0, 102, 0);">get</span><span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(0, 0, 255);">$this</span>-&gt;<span style="color: rgb(0, 102, 0);">key</span>.<span style="color: rgb(0, 0, 255);">$id</span><span style="color: rgb(102, 204, 102);">)</span><span style="color: rgb(102, 204, 102);">)</span> <span style="color: rgb(102, 204, 102);">{</span>
      <span style="color: rgb(177, 177, 0);">return</span> <span style="color: rgb(0, 0, 255);">$sess_data</span>;
    <span style="color: rgb(102, 204, 102);">}</span> <span style="color: rgb(177, 177, 0);">else</span> <span style="color: rgb(102, 204, 102);">{</span>
      <span style="color: rgb(177, 177, 0);">return</span> <span style="color: rgb(255, 0, 0);">''</span>;
    <span style="color: rgb(102, 204, 102);">}</span>
  <span style="color: rgb(102, 204, 102);">}</span>
&nbsp;
  <span style="color: rgb(128, 128, 128); font-style: italic;">/**
   *
   * write 関数
   *
   * @param string セッションID
   * @param string データ
   * @retrun bool
   */</span>
  <span style="color: rgb(0, 0, 0); font-weight: bold;">function</span> write<span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(0, 0, 255);">$id</span>, <span style="color: rgb(0, 0, 255);">$sess_data</span><span style="color: rgb(102, 204, 102);">)</span>
  <span style="color: rgb(102, 204, 102);">{</span>
    <span style="color: rgb(177, 177, 0);">if</span> <span style="color: rgb(102, 204, 102);">(</span><a href="http://www.php.net/trim"><span style="color: rgb(0, 0, 102);">trim</span></a><span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(0, 0, 255);">$id</span><span style="color: rgb(102, 204, 102);">)</span> == <span style="color: rgb(255, 0, 0);">''</span><span style="color: rgb(102, 204, 102);">)</span> <span style="color: rgb(177, 177, 0);">return</span> <span style="color: rgb(0, 0, 0); font-weight: bold;">true</span>;
    <span style="color: rgb(0, 0, 255);">$compress</span> = <span style="color: rgb(0, 0, 255);">$this</span>-&gt;<span style="color: rgb(0, 102, 0);">CI</span>-&gt;<span style="color: rgb(0, 102, 0);">config</span>-&gt;<span style="color: rgb(0, 102, 0);">item</span><span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(255, 0, 0);">'compress'</span>, <span style="color: rgb(0, 0, 255);">$this</span>-&gt;<span style="color: rgb(0, 102, 0);">conf_name</span><span style="color: rgb(102, 204, 102);">)</span>;
    <span style="color: rgb(0, 0, 255);">$expires</span>  = <a href="http://www.php.net/ini_get"><span style="color: rgb(0, 0, 102);">ini_get</span></a><span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(255, 0, 0);">&quot;session.gc_maxlifetime&quot;</span><span style="color: rgb(102, 204, 102);">)</span>;
    <span style="color: rgb(0, 0, 255);">$ret</span> = <span style="color: rgb(0, 0, 255);">$this</span>-&gt;<span style="color: rgb(0, 102, 0);">memcache</span>-&gt;<span style="color: rgb(0, 102, 0);">set</span><span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(0, 0, 255);">$this</span>-&gt;<span style="color: rgb(0, 102, 0);">key</span>.<span style="color: rgb(0, 0, 255);">$id</span>, <span style="color: rgb(0, 0, 255);">$sess_data</span>, <span style="color: rgb(0, 0, 255);">$compress</span>, <span style="color: rgb(0, 0, 255);">$expires</span><span style="color: rgb(102, 204, 102);">)</span>;
    <span style="color: rgb(177, 177, 0);">return</span> <span style="color: rgb(0, 0, 255);">$ret</span>;
  <span style="color: rgb(102, 204, 102);">}</span>
&nbsp;
  <span style="color: rgb(128, 128, 128); font-style: italic;">/**
   *
   * destroy 関数
   *
   * @param string セッションID
   * @return bool
   */</span>
  <span style="color: rgb(0, 0, 0); font-weight: bold;">function</span> destroy<span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(0, 0, 255);">$id</span><span style="color: rgb(102, 204, 102);">)</span>
  <span style="color: rgb(102, 204, 102);">{</span>
    <span style="color: rgb(0, 0, 255);">$ret</span> = <span style="color: rgb(0, 0, 255);">$this</span>-&gt;<span style="color: rgb(0, 102, 0);">memcache</span>-&gt;<span style="color: rgb(0, 102, 0);">delete</span><span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(0, 0, 255);">$this</span>-&gt;<span style="color: rgb(0, 102, 0);">key</span>.<span style="color: rgb(0, 0, 255);">$id</span><span style="color: rgb(102, 204, 102);">)</span>;
    <span style="color: rgb(177, 177, 0);">return</span> <span style="color: rgb(0, 0, 255);">$ret</span>;
  <span style="color: rgb(102, 204, 102);">}</span>
&nbsp;
  <span style="color: rgb(128, 128, 128); font-style: italic;">/**
   *
   * ガベージコレクタ
   *
   * @return bool
   */</span>
  <span style="color: rgb(0, 0, 0); font-weight: bold;">function</span> gc<span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(0, 0, 255);">$maxlifetime</span><span style="color: rgb(102, 204, 102);">)</span>
  <span style="color: rgb(102, 204, 102);">{</span>
    <span style="color: rgb(177, 177, 0);">return</span> <span style="color: rgb(0, 0, 0); font-weight: bold;">true</span>;
  <span style="color: rgb(102, 204, 102);">}</span>
&nbsp;
  <span style="color: rgb(128, 128, 128); font-style: italic;">/**
   *
   * SESSIONへの値の設定
   *
   * @param string キー
   * @param string 値
   * @return void
   */</span>
  <span style="color: rgb(0, 0, 0); font-weight: bold;">function</span> set<span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(0, 0, 255);">$key</span>, <span style="color: rgb(0, 0, 255);">$value</span><span style="color: rgb(102, 204, 102);">)</span>
  <span style="color: rgb(102, 204, 102);">{</span>
    <span style="color: rgb(0, 0, 255);">$_SESSION</span><span style="color: rgb(102, 204, 102);">[</span><span style="color: rgb(0, 0, 255);">$key</span><span style="color: rgb(102, 204, 102);">]</span> = <span style="color: rgb(0, 0, 255);">$value</span>;
  <span style="color: rgb(102, 204, 102);">}</span>
&nbsp;
  <span style="color: rgb(128, 128, 128); font-style: italic;">/**
   *
   * SESSIONからの値の取得
   *
   * @param string キー
   * @return mixed
   */</span>
  <span style="color: rgb(0, 0, 0); font-weight: bold;">function</span> get<span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(0, 0, 255);">$key</span><span style="color: rgb(102, 204, 102);">)</span>
  <span style="color: rgb(102, 204, 102);">{</span>
    <span style="color: rgb(0, 0, 255);">$ret</span> = <span style="color: rgb(0, 0, 255);">$_SESSION</span><span style="color: rgb(102, 204, 102);">[</span><span style="color: rgb(0, 0, 255);">$key</span><span style="color: rgb(102, 204, 102);">]</span>;
    <span style="color: rgb(177, 177, 0);">return</span> <span style="color: rgb(0, 0, 255);">$ret</span>;
  <span style="color: rgb(102, 204, 102);">}</span>
&nbsp;
<span style="color: rgb(102, 204, 102);">}</span></pre>
</td>
</tr>
</tbody>
</table>
</div>
<p>&nbsp;</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.veryposi.info/programing/php/codeigniter-memcache-session-php/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>PHPシステム開発　DB管理ツール</title>
		<link>http://blog.veryposi.info/programing/php/php-dev-dbadmin-1/</link>
		<comments>http://blog.veryposi.info/programing/php/php-dev-dbadmin-1/#comments</comments>
		<pubDate>Sat, 28 Feb 2009 08:17:20 +0000</pubDate>
		<dc:creator>gensan</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[codeigniter]]></category>

		<guid isPermaLink="false">http://blog.veryposi.info/?p=803</guid>
		<description><![CDATA[PHPで、データベース管理ツールといえば有名な「phpMyAdmin」があります。 でも、実際にシステム開発やシステムの運用時に使用していると、思わぬ操作をしてしまって大怪我することもある可能性があると思います。 システ [...]]]></description>
			<content:encoded><![CDATA[<p>PHPで、データベース管理ツールといえば有名な「phpMyAdmin」があります。</p>
<p>でも、実際にシステム開発やシステムの運用時に使用していると、思わぬ操作をしてしまって大怪我<img src="http://blog.veryposi.info/wp-content/plugins/fckeditor-for-wordpress-plugin/smiles/typepad/impact.gif" alt="" />することもある可能性があると思います。</p>
<p>システム開発用に簡易DB管理ツールを作ろうと思います<img src="http://blog.veryposi.info/wp-content/plugins/fckeditor-for-wordpress-plugin/smiles/typepad/happy02.gif" alt="" /></p>
<p>■　仕様</p>
<ul>
<li>テーブルの作成</li>
<li>テーブルレイアウトの変更</li>
<li>データの検索</li>
<li>データの更新</li>
<li>データの削除</li>
<li>データの登録</li>
<li>データのインポート／エクスポート</li>
<li>IDを各テーブルのプライマリーキーとして保持</li>
</ul>
<p>あとは&hellip;色々と便利機能を追加</p>
<p>基本的な機能を備えて、かつシステム開発時に楽できる機能を保持するように考慮するようにします。</p>
<p>Webでのシステムですが、CodeIgniterというフレームワークを使って作ります。</p>
<p>乞うご期待<img src="http://blog.veryposi.info/wp-content/plugins/fckeditor-for-wordpress-plugin/smiles/typepad/up.gif" alt="" /></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.veryposi.info/programing/php/php-dev-dbadmin-1/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHPフレームワーク &#8211; CodeIgniter入門　CodeIgniterを動かそう！！</title>
		<link>http://blog.veryposi.info/programing/php/codeigniter-guide-1/</link>
		<comments>http://blog.veryposi.info/programing/php/codeigniter-guide-1/#comments</comments>
		<pubDate>Sat, 21 Feb 2009 07:11:57 +0000</pubDate>
		<dc:creator>gensan</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[codeigniter]]></category>

		<guid isPermaLink="false">http://blog.veryposi.info/?p=688</guid>
		<description><![CDATA[まずは、習うより慣れろということでCodeIgniterを動かしてみましょう。 CodeIgniterのソースファイルを「CodeIgniter」のサイトからダウンロードしてきてください。 (2009年2月21日時点では [...]]]></description>
			<content:encoded><![CDATA[<p>まずは、習うより慣れろということでCodeIgniterを動かしてみましょう。</p>
<p>CodeIgniterのソースファイルを「<a href="http://codeigniter.com/">CodeIgniter</a>」のサイトからダウンロードしてきてください。<br />
(2009年2月21日時点では、ver1.7.1でした）</p>
<p>ダウンロードした圧縮ファイル「CodeIgniter_1.7.1.zip」を解凍すると</p>
<ul>
<li>system</li>
<li>user_guide</li>
<li>index.php</li>
<li>license.txt</li>
</ul>
<p>の4つのフォルダとファイルが出てくると思います。</p>
<p>この出てきた中から</p>
<ul>
<li>system</li>
<li>index.php</li>
</ul>
<p>の2つをWebサーバから参照できる場所に配置してください。<br />
（テスト環境ができていないようでしたら、<a href="http://blog.veryposi.info/programing/php/php-guide-2/">こちら</a>に開発環境の構築方法をのせているので確認してください）</p>
<p>配置できたらindex.phpにウェブブラウザでアクセスしてみてください。</p>
<p>私のテスト環境では「http://192.168.25.130:8000」にて参照できるWebサーバーに「ci」という名前のフォルダを作成して「ci」フォルダの中に配置したので</p>
<p>「http://192.168.25.130:8000/ci/index.php」にアクセスすると以下のようなページが表示されます。</p>
<p><a href="http://blog.veryposi.info/wp-content/uploads/2009/02/codeigniter-guide.png" rel="lightbox[688]"><img height="148" width="300" src="http://blog.veryposi.info/wp-content/uploads/2009/02/codeigniter-guide-300x148.png" alt="CodeIgniterの初めてのページ" title="CodeIgniterの初めてのページ" class="aligncenter size-medium wp-image-694" /></a></p>
<p>これが表示されたらとりあえずCodeIgniterを使用する為の準備はできました。</p>
<p><span style="color: rgb(204, 0, 0);">※　http://192.168.25.130:8000/ci/index.phpは、私の環境なので各自のテスト環境でのアドレスに読み直してくださいね</span></p>
<p>この動作がどのように動いているかですが</p>
<ol>
<li>index.phpの中でCodeIgniterのコアファイルが読み込まれます。</li>
<li>「system\application\config」の中にあるroutes.phpの43行目
<div class="syntax">
<table>
<tbody>
<tr>
<td class="line_numbers">
<pre>
1
</pre>
</td>
<td class="code">
<pre class="php"><span style="color: rgb(0, 0, 255);">$route</span><span style="color: rgb(102, 204, 102);">[</span><span style="color: rgb(255, 0, 0);">'default_controller'</span><span style="color: rgb(102, 204, 102);">]</span> = <span style="color: rgb(255, 0, 0);">&quot;welcome&quot;</span>;</pre>
</td>
</tr>
</tbody>
</table></div>
<p>    の記述を見てCodeIgniterはwelcomというコントローラーを動かしに行きます。<br />
    （コントローラーの指定がないため）</li>
<li>「system\application\controllers」の中のwelcom.phpのindexメソッドが実行されます。
<div class="syntax">
<table>
<tbody>
<tr>
<td class="line_numbers">
<pre>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
</pre>
</td>
<td class="code">
<pre class="php"><span style="color: rgb(0, 0, 0); font-weight: bold;">&lt;?php</span>
&nbsp;
<span style="color: rgb(0, 0, 0); font-weight: bold;">class</span> Welcome <span style="color: rgb(0, 0, 0); font-weight: bold;">extends</span> Controller <span style="color: rgb(102, 204, 102);">{</span>
&nbsp;
	<span style="color: rgb(0, 0, 0); font-weight: bold;">function</span> Welcome<span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(102, 204, 102);">)</span>
	<span style="color: rgb(102, 204, 102);">{</span>
		parent::<span style="color: rgb(0, 102, 0);">Controller</span><span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(102, 204, 102);">)</span>;
	<span style="color: rgb(102, 204, 102);">}</span>
&nbsp;
	<span style="color: rgb(0, 0, 0); font-weight: bold;">function</span> index<span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(102, 204, 102);">)</span>
	<span style="color: rgb(102, 204, 102);">{</span>
		<span style="color: rgb(0, 0, 255);">$this</span>-&gt;<span style="color: rgb(0, 102, 0);">load</span>-&gt;<span style="color: rgb(0, 102, 0);">view</span><span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(255, 0, 0);">'welcome_message'</span><span style="color: rgb(102, 204, 102);">)</span>;
	<span style="color: rgb(102, 204, 102);">}</span>
<span style="color: rgb(102, 204, 102);">}</span>
&nbsp;
<span style="color: rgb(128, 128, 128); font-style: italic;">/* End of file welcome.php */</span>
<span style="color: rgb(128, 128, 128); font-style: italic;">/* Location: ./system/application/controllers/welcome.php */</span></pre>
</td>
</tr>
</tbody>
</table></div>
</li>
<li>12行目の記述を見てCodeIgniterは「system\application\views」の中のwelcome_message.phpを呼び出し先ほどの「Welcome to CodeIgniter!」画面を表示しています。</li>
</ol>
<p>これが今、「Welcome to CodeIgniter!」画面が表示された動きです。</p>
<p>ここまでの流れを聞いてフレームワークを使用したことが無い人には、なんでそうなるの<img alt="" src="http://blog.veryposi.info/wp-content/plugins/fckeditor-for-wordpress-plugin/smiles/typepad/sign02.gif" /><br />
って疑問とよくわからんという感想が残ったかもしれません。</p>
<p>なので、CodeIgniterというフレームワークの動作を説明したいと思います。</p>
<p>と思いましたが今回はここまで、次回解説いたします。</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.veryposi.info/programing/php/codeigniter-guide-1/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>CodeIgniter入門</title>
		<link>http://blog.veryposi.info/programing/php/codeigniter-guide/</link>
		<comments>http://blog.veryposi.info/programing/php/codeigniter-guide/#comments</comments>
		<pubDate>Thu, 19 Feb 2009 01:32:35 +0000</pubDate>
		<dc:creator>gensan</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[codeigniter]]></category>

		<guid isPermaLink="false">http://blog.veryposi.info/?p=649</guid>
		<description><![CDATA[PHPの軽量フレームワーク「CodeIgniter」 日本ではあまり有名ではないですが、PHPフレームワークの中では最速を誇るフレームワークです 余計なことをしないところも結構素敵 足りない部分は自分で機能を追加しないと [...]]]></description>
			<content:encoded><![CDATA[<p>PHPの軽量フレームワーク「<a href="http://codeigniter.jp/user_guide_ja/">CodeIgniter</a>」</p>
<p>日本ではあまり有名ではないですが<img alt="" src="http://blog.veryposi.info/wp-content/plugins/fckeditor-for-wordpress-plugin/smiles/typepad/down.gif" />、PHPフレームワークの中では最速を誇るフレームワークです<img alt="" src="http://blog.veryposi.info/wp-content/plugins/fckeditor-for-wordpress-plugin/smiles/typepad/sign01.gif" /><br />
余計なことをしないところも結構素敵<img alt="" src="http://blog.veryposi.info/wp-content/plugins/fckeditor-for-wordpress-plugin/smiles/typepad/note.gif" /></p>
<p>足りない部分は自分で機能を追加しないといけないが、それでも使いやすさ抜群のフレームワークです。</p>
<p>これからCodeIgniterを使用してサイトを構築していくのでその過程をここで公開していきます。</p>
<h3>目次</h3>
<ol>
<li><a href="http://blog.veryposi.info/programing/php/codeigniter-guide-1/">CodeIgniterを動かそう！！</a></li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://blog.veryposi.info/programing/php/codeigniter-guide/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHPのおすすめフレームワーク『CodeIgniter』</title>
		<link>http://blog.veryposi.info/programing/php/php-framework-codeigniter/</link>
		<comments>http://blog.veryposi.info/programing/php/php-framework-codeigniter/#comments</comments>
		<pubDate>Mon, 02 Feb 2009 18:20:05 +0000</pubDate>
		<dc:creator>gensan</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[codeigniter]]></category>
		<category><![CDATA[framework]]></category>

		<guid isPermaLink="false">http://blog.veryposi.info/?p=65</guid>
		<description><![CDATA[&#160; 現在、PHPを使って仕事をしているのですがおすすめのフレームワークがあります。 「CodeIgniter」というフレームワークです。 PHP4／PHP5どちらでも動作し軽量、高速です。 Ruby on Ra [...]]]></description>
			<content:encoded><![CDATA[<p>&nbsp;</p>
<p>現在、PHPを使って仕事をしているのですがおすすめのフレームワークがあります。</p>
<p>「<a href="http://codeigniter.jp/user_guide_ja/">CodeIgniter</a>」というフレームワークです。</p>
<p>PHP4／PHP5どちらでも動作し軽量、高速です。</p>
<p>Ruby on Railsの流れのフレームワークが流行っていますが余計なことはせずただMVCモデルで出来上がったシンプルなフレームワークです。</p>
<p>一度使ってみてください<img src="http://blog.veryposi.info/wp-content/plugins/fckeditor-for-wordpress-plugin/smiles/typepad/sign01.gif" alt="" /></p>
<p>絶対に好きになると思いますよ<img src="http://blog.veryposi.info/wp-content/plugins/fckeditor-for-wordpress-plugin/smiles/typepad/catface.gif" alt="" /></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.veryposi.info/programing/php/php-framework-codeigniter/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Served from: blog.veryposi.info @ 2026-04-05 11:05:21 -->