我有一个基于Codeigniter 1.7.2的PHP应用程序,目前正在生产和现场,似乎有严重的内存泄漏.
通过查看服务器上的"top",内存泄漏很明显:
top - 23:42:13 up 26 days, 10:14, 1 user, load average: 0.00, 0.00, 0.00
Tasks: 54 total, 1 running, 53 sleeping, 0 stopped, 0 zombie
Cpu(s): 0.0%us, 0.0%sy, 0.0%ni,100.0%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st Mem: 7872040k total, 929748k used, 6942292k free, 142464k buffers
Swap: 0k total, 0k used, 0k free, 214420k cached
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
22740 apache 15 0 308m 63m 5976 S 0 0.8 0:14.05 httpd
22733 apache …Run Code Online (Sandbox Code Playgroud) 我正在设计一个功能齐全的网站,其中包含主页上的博客.我希望它是全功能的,但我不想花费永远编码.有没有可以轻松与CodeIgniter集成的好博客系统?
我在Ubuntu 10(LAMP)上有Codeigniter.我有一个htaccess文件:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /dort
#Removes access to the system folder by users.
#Additionally this will allow you to create a System.php
#controller, previously this would not have been possible.
#'system' can be replaced if you have renamed your system folder.
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /dort/index.php?/$1 [L]
#Checks to see if the user is attempting to access a valid file,
#such as an image or css document, if this isn't true it sends
#the request to …Run Code Online (Sandbox Code Playgroud) 我有一个从表中检索所有标签的函数:
function global_popular_tags() {
$this->db->select('tags.*, COUNT(tags.id) AS count');
$this->db->from('tags');
$this->db->join('tags_to_work', 'tags.id = tags_to_work.tag_id');
$this->db->group_by('tags.id');
$this->db->order_by('count', 'desc');
$query = $this->db->get()->result_array();
return $query;
}
Run Code Online (Sandbox Code Playgroud)
我有另一张名为'work'的表.'work'表有一个'draft'列,其值为1或0.我希望COUNT(tags.id)考虑具有特定标记的工作是否处于草稿模式(1).
比如,有10件作品被标记为"设计".COUNT将是10.但是这些工作中有2个处于草稿模式,因此COUNT应该是8.如何管理?
如果validation_errors()数组中有任何错误,我想显示一般错误消息,但如果我做了类似的事情
if(isset(validation_errors())) { echo 'error'; }
Run Code Online (Sandbox Code Playgroud)
然后它返回并说:
致命错误:在写上下文中不能使用函数返回值
任何帮助都会很棒.
我在CI中看到两种类型的结构.例如...
class Blog extends CI_Controller
{
function __construct()
{
parent::__construct();
}
}
Run Code Online (Sandbox Code Playgroud)
和
class Blog extends CI_Controller
{
function Blog()
{
parent::Controller();
}
}
Run Code Online (Sandbox Code Playgroud)
他们之间有什么区别?我不知道该选哪个.
有人知道原因:
class Booking extends Controller {
function booking()
{
parent::Controller();
}
function send_instant_to_paypal()
{
print_r($_POST);
echo '<hr />';
print_r($this->input->post());
echo '<hr />';
$id_booking = $this->input->post('id_booking');
$title = $this->input->post('basket_description');
$cost = ($this->input->post('fee_per_min') * $this->input->post('amount'));
echo $id_booking;
echo $title
echo $cost
}
}
Run Code Online (Sandbox Code Playgroud)
将回显CI中的变量用于$ _POST但不用于$ this-> input-> post();?
我已经使用了$ this-> input-> post()并在网站的其他地方搜索了一个搜索页...但是在这个页面上,它不起作用..这是我的表格......
<form id="add_funds" action="' . site_url('booking/send_instant_to_paypal') . '" method="post">
<input type="text" name="amount" id="amount" value="" />
<input type="hidden" name="id_booking" id="id_booking" value="0" />
<input type="hidden" name="basket_description" id="basket_description" value="Adding Credit" />
<input type="hidden" name="fee_per_min" … 嘿伙计们,凌晨3点36分,我需要精神上的提升.
简单的问题是,向数据库添加100个点的最简单/最快的方法是什么.请假设由于重复,错误数据等原因,所有写入都不起作用.
我正在尝试使用100个值更新数据库.
一旦我有一个好的数据,我需要将它添加到数据库,我使用一个名为updateDB的函数.
此函数只是将lat/lng坐标写入数据库.如果有重复或写入失败,我从php发送"错误",循环应继续收集数据,直到我有100个数据库点.这是我正在使用的功能.
cct用于xss预防,请忽略它,这很好用.
////more above this
if(100-completed > dispatched)
dispatched++;
updateDB(lat,lng);
/// more junk and then this function
function updateDB(lat,lng)
{
var cct = $("input[name=csrf_mysite]").val();
$.ajax({
type: "POST",
url: "/form",
data: {
'lat': lat,
'lng': lng,
'id_set': id_set,
'csrf_complexity': cct },
success: function(result) {
var obj = jQuery.parseJSON(result);
if( obj.status === "OK" )
{
completed++;
var marker = new google.maps.Marker(
{
icon: markerIcon,
position: new google.maps.LatLng(lat, lng),
map: map
});
$( "#progressbar" ).progressbar( "option", {
value: completed, …Run Code Online (Sandbox Code Playgroud) 在CodeIgniter中实现ACL的最佳方法是什么?
以下是我们正在合作的内容:
文章,作者
作者有两种类型:
考虑到功能将扩展(需要对作者类型进行权限限制的更多功能),在CodeIgniter中执行ACL的最佳方法是什么?
我希望在基于CodeIgniter的应用程序中为用户的配置文件信息提供一个干净的URL.
请查看下面的URL格式.
Actual URL : http://www.mydomain.com/index.php/users/profile/user1
Run Code Online (Sandbox Code Playgroud)
我期待用户拥有个人网址
http://www.mydomain.com/user1
http://www.mydomain.com/user2
http://www.mydomain.com/user3
Run Code Online (Sandbox Code Playgroud)
URL http://www.mydomain.com/user1应在后台执行时处理http://www.mydomain.com/index.php/users/profile/user1.
我将使用Route库从URL中删除index.php.
提前感谢您提供任何帮助.