文字列の高度な処理・加工04
☆★データーでの確認★☆
エスケープされた文字列をもとに戻す
stripcslashes関数
- addslashes関数などによってエスケープされた文字列から「\」を取り去って、もとの文字列に直す。
【 書式 】
<?php $data = "\'PHP\'\$\%\#\@"; // 文字列から「\」を取り除く print stripcslashes($data); ?>
ソースコード
ソースコード【 HTML 】
<!DOCTYPE html> <html lang="ja"> <head> <meta charset="UTF-8"> <meta name="description" content="文字列の処理"> <meta name="keywords" content="PHP,数値の処理"> <meta name="viewport" content="width=device-width,initial-scale=1"> <title>文字列の処理</title> <link rel="shortcut icon" href="../favicon.gif"> <!-- IE対策 --> <!--[if ite IE 9]> <script src="http://html5shiv.googlecode.com/svn/ttunk/html5.js"></script> <![endif]--> <style> article,aside,dialog,figure,footer,header, hgroup,menu,nav,section{ display: block;} </style> <link href="css/style.css" rel="stylesheet" type="text/css" media="all"> </head> <body> <div id="container"> <header><h1><span>文字列の高度な処理・加工</span></h1></header> <section id="contents"> <h1><span>4-4</span>エスケープされた文字列をもとに戻す</h1> <section class="sec-top"> <h2>stripcslashes関数</h2> <p class="mark"><span>P</span>oint</p> <div class="box"> <dl> <dt>stripcslashes関数</dt> <dd> <ul> <li>addslashes関数などによってエスケープされた文字列から「\」を取り去って、もとの文字列に直す。</li> </ul> </dd> </dl> </div> </section> <section class="sec-php"> <h2>ブラウザでの表示</h2> <div class="box"> <?php $data = "\'PHP\'\$\%\#\@"; // 文字列から「\」を取り除く print stripcslashes($data); ?> </div> </section> </section> <footer> <h1>PHPスクリプト</h1> <p>参考資料:<a href="http://d.hatena.ne.jp/webry/20130825/p2#note_second" target="_blank">速攻&活用! Web開発者のためのPHPベストサンプル集</a></p> <dl> <dt>まとめサイト:</dt> <dd> <ul> <li><a href="http://webrynote.jimdo.com/" target="_blank">動画で確認するscript | FlashとJavaScrip</a></li> <li><a href="http://d.hatena.ne.jp/webry/archive?word=%2A%5BWEB%B3%AB%C8%AF%5D" target="_blank">[WEB開発]</a></li> <li><a href="http://d.hatena.ne.jp/webry/20130217/p4" target="_blank">[PHP]</a></li> <li><a href="http://d.hatena.ne.jp/webry/20130205/p2" target="_blank">[jQuery]</a></li> <li><a href="http://d.hatena.ne.jp/webry/20121222/p2" target="_blank">[JavaScript]</a></li> <li><a href="http://d.hatena.ne.jp/webry/20130408/p6" target="_blank">[HTML5]</a></li> </ul> </dd> </dl> <small>Copyright© 2013 <a href="http://d.hatena.ne.jp/webry/" title="webryのホームページへ" target="_blank">実践するWEBサイト制作 | webnote</a> All Rights Reserved.</small> </footer> <!-- /#container --> </div> </body> </html>
@charset "utf-8"; /* webfont ------------------------------------------------------ */ @import url(http://fonts.googleapis.com/css?family=Lobster); @import url(http://fonts.googleapis.com/css?family=Bangers); /* resetcss ------------------------------------------------------ */ html,body,div,h1,h2,h3,h4,h5,h6,p,blockquote,pre,address,ul,ol,li,dl,dt,dd,table,th,td,form,fieldset { margin: 0; padding: 0; line-height: 1.5; font-family: "Hiragino Kaku Gothic ProN", Meiryo, sans-serif;} a { text-decoration: none;} ul, ol { list-style-type: none;} img { border: 0; vertical-align: bottom;} /* link ----------------------------------------------------- */ a:link {color:#00F;} a:visited {color:#306;} a:hover,a:active {color:#F6C;} footer small a:link,footer small a:visited {color:#fff;} footer small a:hover,footer small a:active {color:#F00;} footer small a {font-size: 121%;} /* base ---------------------------------------------------- */ body { color: #333;} /* layout ---------------------------------------------------- */ #container { width: 960px; margin: 0 auto;} header { margin: 0 0 20px; padding: 24px 30px 18px 70px; background: #3D6DFF url(../../images/w_top.png) no-repeat right 30px bottom; border-radius: 20px 20px 0 0 / 20px 20px 0 0; position: relative; color: #fff;} header h1:before { content: "3"; font-family: 'Lobster', cursive; display: block; color: #ffff; float: left; font-size: 196%; position: absolute; top: 0.2em; left: 20px;} header h1 { border-bottom: 5px dotted #fff;} header h1 span { font-family: 'Bangers', cursive; display: block; width: 830px; margin: 0 auto;} #contents { width: 960px; margin: 0 auto;} #contents h1 { padding: 5px 5px 4px; background: #3D6DFF url(../../images/w_bottom.png) no-repeat right 30px top; font-size: 20px; color: #fff; overflow: hidden;} #contents h1 span { padding: 0 6px; margin: 0 8px 0 3px; font-size: 112%; border: 1px solid #fff;} #contents h2 { font-size: 18px;} section { margin: 15px 0 0;} .mark { line-height: 1.0; font-family: 'Maven Pro', Helverica, Arial, sans-serif; float: left; background-color: #F60; border-radius: 55px / 48px; padding: 12px 26px; text-align: center; font-weight: bold; font-size: 14px; color: #fff; box-shadow: 0 0 0 5px rgba(255,102,0,0.4);} .mark span { display: block; font-size: 32px; line-height: 1.0;} section.sec-top h2 { width: 851px; float: right; padding: 7px 15px 2px; border-bottom: 1px dashed #ccc; color: #F00;} .box { clear: both; width: 88%; margin: 0 auto; padding: 15px 0 0;} section.sec-top .box dl dt { margin: 15px 0 5px; padding: 0 0 0 8px; border-left: 6px solid #345EDB; font-weight: bold;} section.sec-top .box dl dt:first-child { margin: 0 0 5px;} section.sec-top .box dl dd { margin: 0 0 0 20px; padding: 0 18px;} section.sec-top .box dl dd ul li { background: url(../../images/circle.gif) no-repeat left 0.3em; padding-left: 20px;} section.sec-top .box dl dd ul.txt-last li:last-child { background: none; font-size: 96%;} section.sec-top .box dl dd ul.txt-last li:last-child::before { content: "※"; font-size: 112%; margin: 0 5px 0 -10px; color: #F00;} #contents section.sec-php h2 { font-size: 88%; color: #893B45;} section.sec-php h2:before { content: "▼"; margin: 0 4px 0 25px;} section.sec-php .box { padding: 20px 15px; border: 2px dotted #3FF; background: #ECF9FF;} /* footer ------------------------------------------------ */ footer { position: relative; margin: 35px 0 0; padding: 5px 10px 55px; background: #3D6DFF; text-align: center; font-size: 12px; color: #fff;} footer h1 { font-size: 16px;} footer h1:before { content: "− ";} footer h1:after { content: " −";} footer dl { width: 98%;} footer dl dt { float: left; width: 29%; text-align: right;} footer dl dd { float: right; text-align: left; width: 71%;} footer dl dd ul { width: 100%;} footer dl dd ul li { display: inline; padding: 0 0 0 5px;} footer dl dd ul li a:hover { background: #4271FF; color: #FF666B;} footer dl dd ul li:after { content: ",";} footer dl dd ul li:last-child::after { content: "";} footer small { position: absolute; bottom: 0; left: 0; width: 100%; height: 30px; padding: 5px 0 0; background: rgba(0, 0, 0, 0.75); font-size: 83%; } /* clearFix --------------------------------------------- */ .box:after { content: ""; display: block; clear: both;} @media only screen and (max-width:320px) { #container { width: 300px; padding: 10px; margin: 0;} header { width: 272px; margin: 0; padding: 10px 0 0 28px; background: #fff none; border-radius: 0 / 0; position: relative; color: #000;} header h1:before { content: "3"; font-family: 'Lobster', cursive; display: inline; color: #f00; float: left; font-size: 196%; position: absolute; top: 0; left: 0;} header h1 { width: 100%; padding: 0 0 5px; border-bottom: 2px dotted #ccc; font-size: 20px;} header h1 span { font-family: 'Bangers', cursive; display: block; width: 100%; margin: 0;} #contents { width: 100%; margin: 0;} #contents h1 { padding: 0 3px 2px; background: #3D6DFF none; font-size: 16px; color: #fff; overflow: hidden;} #contents h1 span { display: block; width: 20%; padding: 0 6px; margin: 2px auto 3px; font-size: 112%; border: 1px solid #fff; text-align: center;} #contents h2 { font-size: 16px;} section { margin: 10px 0 0;} .mark { line-height: 1.0; font-family: 'Maven Pro', Helverica, Arial, sans-serif; float: right; background-color: #F60; border-radius: 30px / 30px; padding: 12px 20px; text-align: center; font-weight: bold; font-size: 0; color: #fff; box-shadow: 0 0 0 5px rgba(255,102,0,0.4);} .mark span { display: block; font-size: 24px; line-height: 1.0;} section.sec-top h2 { width: 170px; float: left; padding: 0 70px 0 0; border-bottom: 1px dashed #ccc; color: #F00;} .box { clear: both; width: 100%; margin: 0 auto; padding: 15px 0 0;} section.sec-top .box dl dt { margin: 0 0 5px; padding: 0 0 0 8px; border-left: 6px solid #345EDB; font-weight: bold;} section.sec-top .box dl dd { margin: 0; padding: 0;} section.sec-top .box dl dd ul li { background: url(../../images/circle.gif) no-repeat left 0.4em; padding-left: 16px;} section.sec-top .box dl dd ul.txt-last li:last-child { background: none; font-size: 96%;} section.sec-top .box dl dd ul.txt-last li:last-child::before { content: "※"; font-size: 112%; margin: 0 5px 0 -10px; color: #F00;} #contents section.sec-php h2 { font-size: 88%; color: #893B45;} section.sec-php h2:before { content: "▼"; margin: 0 4px 0 5px;} section.sec-php .box { width: 280px; padding: 10px 5px; border: 2px dotted #3FF; background: #ECF9FF;} footer { position: none; margin: 5px 0 0; padding: 5px 5px 50px; background: #3D6DFF; text-align: center; font-size: 12px; color: #fff;} footer h1 { font-size: 12px;} footer h1:before { content: "− ";} footer h1:after { content: " −";} footer dl { width: 100%; padding: 0 0 20px;} footer dl dt { display: block; float: none; width: 100%; text-align: center;} footer dl dd { float: none; text-align: center; width: 100%;} footer dl dd ul { width: 100%;} footer dl dd ul li { display: inline; padding: 0 0 0 5px;} footer dl dd ul li a:hover { background: #4271FF; color: #FF666B;} footer dl dd ul li:after { content: ",";} footer dl dd ul li:last-child::after { content: "";} footer small { position: none; width: 290px; height: auto; padding: 5px; background: rgba(0, 0, 0, 0.75); font-size: 10px;} footer small a { display: block; font-size: 13px;} }
ブラウザで表示【 FireFox 】
IEtester【 IE8 】
IEtester【 IE9 】
ブラウザで表示【 Chrome 】
iPhone【 MbileSfari 】