Home > Backend Development > PHP Tutorial > yii - php 字符串里面同时有 "" 和 ' ,本身又是字符串怎么办?

yii - php 字符串里面同时有 "" 和 ' ,本身又是字符串怎么办?

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-06 20:47:41
Original
959 people have browsed it

php 字符串里面同时有 "" 和 ' ,本身又是字符串怎么办?

<code>//已解决
"sDom": "r>t>",

//这句会报错的 
"sDom": "r>t>",

<?php /* @var $this CategoryController */
/* @var $model Category */

Yii::app()->clientScript->registerCssFile(Yii::app()->request->baseUrl.'/assets/DataTables-1.9.4/css/datatable.css');
Yii::app()->clientScript->registerScriptFile(Yii::app()->request->baseUrl.'/assets/DataTables-1.9.4/js/jquery.dataTables.min.js',CClientScript::POS_END);
Yii::app()->clientScript->registerScript('example','
$(document).ready(function() {
    $("#example").dataTable({
         "aaSorting": [[ 0, "desc" ]],
         "sPaginationType": "full_numbers", 
         "sDom": "r>t>",
         "oLanguage": {
            "sUrl": "assets/DataTables-1.9.4/language/zh_CN.json"
         } 
    });
});
',CClientScript::POS_END);
?>

            <div class="col-md-2">
                <div class="panel panel-default">
                    <div class="panel-heading">
                        操作选项
                    </div>
                    <div class="list-group">
                        <?php echo CHtml::link('类别列表',array('index'),array('class'=>'list-group-item')); ?> 
                        <?php echo CHtml::link('类别管理',array('admin'),array('class'=>'list-group-item')); ?> 
                    </div>
                </div>
            </div>
</code>
Copy after login
Copy after login

回复内容:

php 字符串里面同时有 "" 和 ' ,本身又是字符串怎么办?

<code>//已解决
"sDom": "r>t>",

//这句会报错的 
"sDom": "r>t>",

<?php /* @var $this CategoryController */
/* @var $model Category */

Yii::app()->clientScript->registerCssFile(Yii::app()->request->baseUrl.'/assets/DataTables-1.9.4/css/datatable.css');
Yii::app()->clientScript->registerScriptFile(Yii::app()->request->baseUrl.'/assets/DataTables-1.9.4/js/jquery.dataTables.min.js',CClientScript::POS_END);
Yii::app()->clientScript->registerScript('example','
$(document).ready(function() {
    $("#example").dataTable({
         "aaSorting": [[ 0, "desc" ]],
         "sPaginationType": "full_numbers", 
         "sDom": "r>t>",
         "oLanguage": {
            "sUrl": "assets/DataTables-1.9.4/language/zh_CN.json"
         } 
    });
});
',CClientScript::POS_END);
?>

            <div class="col-md-2">
                <div class="panel panel-default">
                    <div class="panel-heading">
                        操作选项
                    </div>
                    <div class="list-group">
                        <?php echo CHtml::link('类别列表',array('index'),array('class'=>'list-group-item')); ?> 
                        <?php echo CHtml::link('类别管理',array('admin'),array('class'=>'list-group-item')); ?> 
                    </div>
                </div>
            </div>
</code>
Copy after login
Copy after login

加转义符“\”


$bar = "foo's baba is bar & foo's mama is bug!"
EOT;

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template