我很难过.我正在做一个简单的ajax表单,用户将输入数据并将数据发送到服务器.
我有以下代码:
<?php
require("/mnt/library/configdb.php");
require("/mnt/library/accessdb.php");
db_config_utility();
db_connect();
//Assign passed parameters
$submitDate = $_POST['submitDate'];
$mname = $_POST['mname'];
$mid = $_POST['mid'];
$coffice = $_POST['coffice'];
$street = $_POST['street'];
$city = $_POST['city'];
$state = $_POST['state'];
$zipcode = $_POST['zipcode'];
$lat = $_POST['lat'];
$lng = $_POST['lng'];
//Setting up sql call
$sql="INSERT INTO manholes(
submit_date,
manhole_name,
manhole_id,
central_office,
street,
city,
state,
zipcode,
latitude,
longitude
)
VALUES (
'$submitDate',
'$mname',
'$mid',
'$coffice',
'$street',
'$city',
'$state',
'$zipcode',
'$lat',
'$lng'
)";
echo("SQL: " . $sql);
//Making sql calls
mysql_query($sql);
?> …
Run Code Online (Sandbox Code Playgroud) 我正在使用指令来尝试替换一些经常重复发生的模板代码,我必须用更简单的东西来编写代码.
假设我有以下原始标记:
<!-- section with repeating stuff in it -->
<div some-attributes etc="etc" very-long-tag="true">
<p class="lead">Some description text</p>
<div class="row section short" ng-repeat="row in things">
<div class="col-sm-6 col-md-4" ng-repeat="app in row.col">
<div class="thumbnail">
<img ng-src="im/things/{{app.image}}" alt="..." class="img-circle" width="250">
<div class="caption">
<h3>{{app.name}}</h3>
<p>{{app.desc}}</p>
</div>
</div>
</div>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
我希望通过这样做来简化它:
<!-- section with repeating stuff in it -->
<xx title="Some description text">
<!-- this innerHTML gets passed to the directive -->
<div class="row section short" ng-repeat="row in things">
<div class="col-sm-6 col-md-4" ng-repeat="app …
Run Code Online (Sandbox Code Playgroud) 在PHP中,我有以下字符串: =CA=CC=D1=C8=C9
什么是字符编码?
如果我有以下字符串:"brasil"和"brasil-carinhoso",我只想替换"brasil",但如果它直接跟随其他字符则不能.
所以,如果我有这个列表:"pac pac pac brasil brasil-carinhoso pac brasil",如果我尝试使用以下代码,它会失败:
//$_GET['exclusion_tags'] is 'brazil'
//$tags_maior is the string: "pac pac pac brasil brasil-carinhoso pac brasil"
$tags_maior = preg_replace('/\b'.$_GET['exclusion_tags'].'\b/u', "", $tags_maior);
Run Code Online (Sandbox Code Playgroud)
当我像这样使用str_replace或preg_replace时,我得到"pac pac pac -carinhoso pac",我需要得到"pac pac pac brasil-carinhoso pac"
我究竟做错了什么?