我有PHP代码用于向会话添加变量:
<?php
session_start();
if(isset($_GET['name']))
{
$name = isset($_SESSION['name']) ? $_SESSION['name'] : array();
$name[] = $_GET['name'];
$_SESSION['name'] = $name;
}
if (isset($_POST['remove']))
{
unset($_SESSION['name']);
}
?>
<pre> <?php print_r($_SESSION); ?> </pre>
<form name="input" action="index.php?name=<?php echo $list ?>" method="post">
<input type="submit" name ="add"value="Add" />
</form>
<form name="input" action="index.php?name=<?php echo $list2 ?>" method="post">
<input type="submit" name="remove" value="Remove" />
</form>
Run Code Online (Sandbox Code Playgroud)
我想$list2在用户选择"删除"时从会话数组中删除显示的变量.
但是当我取消设置时,数组中的所有变量都将被删除.
我怎么能删除一个变量?
因为我想分离系统的前端和后端.我在控制器中创建了2个文件夹作为前端和后端
下面是我的控制器文件夹的结构
controller
--frontend
---store.php
---processing.php
---profile.php
---authenticate.php
---register.php
--backend
---authenticate.php
---stats.php
---users.php
---property_manage.php
---register.php
Run Code Online (Sandbox Code Playgroud)
我可以通过使用来访问这些功能
frontend/store/add
frontend/store/manage
......
backend/stats/sales
backend/stats/payments
.....
Run Code Online (Sandbox Code Playgroud)
但我想从网址中取下前端和后端段.
我检查了codeigniter中的路由功能,但据我所知,我需要单独指定每条路由.由于我有大约12个控制器,每个控制器有大约10-15个功能,我可能需要指定路由的每个功能.
有没有其他有效的方法来实现使用路由或任何其他方式?(不使用任何htaccess)
我刚刚从我的老主人搬到Godaddy,这似乎是一个没有支持的最糟糕的网络主机.
我将我的asp网站(用经典的asp编写)移动到新的godaddy windows主机上.但是当我运行网站时,我得到以下错误
HTTP/1.1新应用程序失败
这个网站与我以前的主持人完美配合.
下面是我在web.config文件中的内容
<?xml version="1.0"?>
<configuration>
<system.webServer>
<httpErrors errorMode="Detailed" />
<asp scriptErrorSentToBrowser="true"/>
</system.webServer>
<system.web>
<customErrors mode="Off"/>
<compilation debug="true"/>
</system.web>
</configuration>
Run Code Online (Sandbox Code Playgroud)
谁能告诉我为什么我会收到这个错误,我该如何解决?
任何帮助将不胜感激.
我试图上传图像,但它总是给我"你没有选择要上传的文件."
我的控制器
function add()
{
$thedate=date('Y/n/j h:i:s');
$replace = array(":"," ","/");
$newname=str_ireplace($replace, "-", $thedate);
$config['upload_path'] = './upload/';
$config['allowed_types'] = 'gif|jpg|png|jpeg';
$config['file_name']=$newname;
$config['max_size'] = '100';
$config['max_width'] = '1024';
$config['max_height'] = '768';
$this->load->library('upload', $config);
//$this->upload->initialize($config);
$this->load->library('form_validation');
$this->form_validation->set_rules('title','title','trim|required');
$this->form_validation->set_rules('description','Description','trim|required');
$image1=$this->input->post('image');
if ($this->form_validation->run()==FALSE){
$this->addview();
return false;
}
if (!$this->upload->do_upload($image1)) {
$error = array('error' => $this->upload->display_errors());
$this->load->view('upload_error', $error);
}
else {
$mage=$this->upload->do_upload($image1);
$data =array(
'title'=>$this->input->post('title'),
'descrip'=>$this->input->post('description'),
'image' => $mage['file_name']
);
$this->load->model('member_functions');
$q=$this->member_functions->insert($data);
}}
Run Code Online (Sandbox Code Playgroud)
设置了所有文件要求和文件权限,但我仍然得到了那个错误.有人可以告诉我,我做错了什么
我试图使用自定义字符串选择一些值.下面是我的代码
$this->db->from('posted');
$st="infor='rent' AND (typeq='in' OR typeq='out')";
$this->db->where($st);
$q = $this->db->get();
Run Code Online (Sandbox Code Playgroud)
发生数据库错误
Run Code Online (Sandbox Code Playgroud)Error Number: 1054 Unknown column ‘infor=‘rent’’ in ‘where clause’ SELECT * FROM (`posted_ads`) WHERE `infor=‘rent’` AND (typeq=‘in’ OR typeq=‘out’) Filename: C:\wamp\www\parklot\system\database\DB_driver.php Line Number: 330
我认为问题是因为
WHERE `infor='rent'`
Run Code Online (Sandbox Code Playgroud)
当我manualy执行此代码时,它完美地工作.
WHERE infor='rent'
Run Code Online (Sandbox Code Playgroud)
我怎么摆脱
``
Run Code Online (Sandbox Code Playgroud)
因为它自动添加
我试图将Swiper插件添加到我的一个页面.我想要实现的是整合将carousal滑块放在这里http://idangero.us/swiper/demos/05-slides-per-view.html
HTML
<div class="swiper-container">
<div class="swiper-wrapper">
<div class="swiper-slide">Slide 1</div>
<div class="swiper-slide">Slide 2</div>
<div class="swiper-slide">Slide 3</div>
<div class="swiper-slide">Slide 4</div>
<div class="swiper-slide">Slide 5</div>
<div class="swiper-slide">Slide 6</div>
<div class="swiper-slide">Slide 7</div>
<div class="swiper-slide">Slide 8</div>
<div class="swiper-slide">Slide 9</div>
<div class="swiper-slide">Slide 10</div>
</div>
<div class="swiper-pagination"></div>
</div>
Run Code Online (Sandbox Code Playgroud)
JS
var swiper = new Swiper('.swiper-container', {
pagination: '.swiper-pagination',
slidesPerView: 3,
paginationClickable: true,
spaceBetween: 30,
// Navigation arrows
nextButton: '.swiper-button-next',
prevButton: '.swiper-button-prev',
});
Run Code Online (Sandbox Code Playgroud)
当我把它添加到小提琴它工作,但当我添加到我的HTML页面,swiper无法工作,直到我打开firebug或调整页面大小(http://vidznet.com/ng1/swiper/swipe.html)我不确定如果初始化时发生冲突,因为控制台中没有错误.
花了一些时间后,我认为它可能是一个jquery问题,并将编码包装在一个
pagebeforecreate
$(document).on( "pagebeforecreate", "#new_",function( event ) {
Run Code Online (Sandbox Code Playgroud)
但仍然是一样的,
我还添加了以下代码
swiper.updateContainerSize(); …Run Code Online (Sandbox Code Playgroud) 我有一个小问题.我访问该站点直通foro.php ID = 74&模式=添加或foro.php ID = 74&模式=编辑它工作得很好.但是当我添加一个冒号,分号(;β-或:)来foro.php ID = 74&模式=添加它转到编辑选项
foro.php ID = 74&模式=补充?;
foro.php?id = 74&mode = add:
foro.php?id = 74&mode = add'
以下是我的代码
<?php
$numb=mysql_real_escape_string($_GET['id']);
if ($_GET['mode']=='add') {
$sql1="select * from cello where number='".mysql_real_escape_string($numb)."' LIMIT 1";
$result1=mysql_query($sql1) or die(mysql_error());
while ($row=mysql_fetch_array($result1)) {
$name=$row['name'];
echo $name;
}
}
elseif ($_GET['mode']='edit') {
$sql="select * from cello account_number='".mysql_real_escape_string($numb)."' limit 1";
$result=mysql_query($sql) or die(mysql_error());
while ($row=mysql_fetch_array($result)) {
$acnumb=$row['number'];
$name=$row['name'];
$address=$row['address'];
echo $acnumb;
echo $name;
echo $address;
}
}
else {echo "error!!";}
?> …Run Code Online (Sandbox Code Playgroud) 我正在尝试在Aforge中应用Bradleys阈值算法
每当我尝试处理图像时,我都会得到以下异常
抛出新的UnsupportedImageFormatException("过滤器不支持源像素格式.");
在应用算法之前,我使用以下方法对图像进行灰度级处理
private void button2_Click(object sender, EventArgs e)
{
Grayscale filter = new Grayscale(0.2125, 0.7154, 0.0721);
Bitmap grayImage = filter.Apply(img);
pictureBox1.Image = grayImage;
}
Run Code Online (Sandbox Code Playgroud)
算法调用的代码
public void bradley(ref Bitmap tmp)
{
BradleyLocalThresholding filter = new BradleyLocalThresholding();
filter.ApplyInPlace(tmp);
}
Run Code Online (Sandbox Code Playgroud)
我在图像处理实验室尝试了理智的图像,它确实有效,但不在我的系统上.
知道我做错了什么吗?
当我尝试从我的数据库中检索数据到表时,我收到此错误:
DataTables warning (table id = 'student_table'): Requested unknown
parameter '1' from the data source for row 0
Run Code Online (Sandbox Code Playgroud)
下面是我使用的javascript
<script type="text/javascript" charset="utf-8">
$(document).ready(function() {
$('#student_table').dataTable( {
"bProcessing": true,
"bServerSide": true,
"sServerMethod": "POST",
"sAjaxSource": "<?php echo base_url()?>index.php/data/all"
} );
} );
</script>
Run Code Online (Sandbox Code Playgroud)
检索到的JSON数据:
{"sEcho":0,"iTotalRecords":3,
"iTotalDisplayRecords":3,
"aaData":[["85","t1","1D"],["74","test475","4A"],
["777","maiz","5"]],"sColumns":"id,name,class"}
Run Code Online (Sandbox Code Playgroud)
以下是我的表格:
<table class="datatable tables" id="student_table">
<thead>
<tr>
<th>ID</th>
<th>Name</th>
<th>Class</th>
</tr>
</thead>
<tbody>
<tr>
<td class="dataTables_empty">Loading data from server</td>
</tr>
</tbody>
</table>
Run Code Online (Sandbox Code Playgroud)
PHP代码(点燃数据表)
$this->load->library('datatables');
$this->datatables->select('admission,name,class');
$this->datatables->from('students');
echo $this->datatables->generate();
Run Code Online (Sandbox Code Playgroud)
我正在使用codeigniter和DataTables.
为什么我会收到该错误以及如何将数据检索到表中?
我使用DataTables(datatables.net)来显示我的数据但是当我添加sDom元素时,没有数据被加载到表中.
以下代码有效
<script type="text/javascript" charset="utf-8">
$(document).ready(function() {
$('#table_main').dataTable( {
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "<?php echo base_url()?>datatable.php"
});
});
</script>
Run Code Online (Sandbox Code Playgroud)
尽管创建了在sDom中给出的标记,但是没有任何数据是从源代码加载的.并且还没有应用fnInitComplete给出的按钮样式
<script type="text/javascript" charset="utf-8">
$(document).ready(function() {
$('#table_main').dataTable( {
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "<?php echo base_url()?>datatable.php",
"sDom": "<'dtTop'<'dtShowPer'l><'dtFilter'f>><'dtTables't><'dtBottom'<'dtInfo'i><'dtPagination'p>>",
"fnInitComplete": function(){
$(".dtShowPer select").uniform();
$(".dtFilter input").addClass("simple_field").css({
"width": "auto",
"margin-left": "15px"
});
}
});
});
</script>
Run Code Online (Sandbox Code Playgroud)
任何有关如何解决此错误的帮助将不胜感激.
php ×7
codeigniter ×3
jquery ×2
aforge ×1
arrays ×1
asp-classic ×1
c# ×1
file-upload ×1
if-statement ×1
javascript ×1
session ×1
swiper ×1