我们的问题
我们正在构建一个基于浏览器的应用程序,允许用户将文件上传到服务器进行处理.服务器端使用Codeigniter v2.0.2框架用PHP编写.要上传的文件是另一个系统的输出,其格式不受我们控制.它们可能非常大(100的MB),但服务器端处理不需要它们的大部分内容.文件本身实际上是zip格式(尽管有一个定制的扩展名),并且包含许多图像文件和一个相对较小的XML文件,只有这样我们才需要进行服务器端处理.显然,当我们需要不到1%的质量时发送整个文件会非常浪费.我们也不想要求用户从文件中手动提取XML.
我的问题
我们有什么选择编写可以从zip中提取XML文件并发送它的客户端代码?很高兴考虑在大多数现代浏览器中运行的任何技术.虽然我们是一个C#/ C++编码器,但Web技术并不是我们的日常工作,因此我们非常感谢代码示例!
非常感谢.
我想使用表单验证来要求密码具有BOTH字母和数字字符.这是我到目前为止所提出的:
$this->form_validation->set_rules('password', 'Password', 'required|matches[passconf]|min_length[8]|alpha_numeric');
Run Code Online (Sandbox Code Playgroud)
问题是"alpha_numeric"要求密码只包含字母或数字,它不需要两者.在这里寻求更强大的密码选项.
有没有人有使用这个插件的经验?我已经获得了php的客户端库,并在我的控制器中设置了相应的功能.当我从香草的插件设置页面点击"测试"时,我得到一个有效的回复,但现在我被卡住了......我从哪里开始?
为了更清楚这个问题,我不知道我的下一步是什么.我的意思是,我知道我必须遗漏一些东西......继承人我正在使用的控制器功能(或页面)作为插件的端点:
// 1. Get your client ID and secret here.
$clientID = "1234";
$secret = "1234";
// 2. Grab the current user from your session management system or database here.
//so i check to see if the user is logged in to my codeigniter's auth
//all works fine
// 3. Fill in the user information in a way that Vanilla can understand.
$user = array();
if ($signedIn) {
// i then set these according to the user info of …Run Code Online (Sandbox Code Playgroud) 我有以下项目结构
/system
/applications
/cache
/core
/helpers
/hook
/language
/libraries
/logs
/third_party
/admin-panel
/config
/controllers
welcome.php
dashboard.php
/errors
/models
/views
welcome.php
dashboard.php
/user-panel
/config
/controllers
welcome.php
dashboard.php
/errors
/models
/views
welcome.php
dashboard.php
/admin
index.php
index.php
Run Code Online (Sandbox Code Playgroud)
我的项目文件夹中的index.php将user-panel作为我的应用程序文件夹,admin文件夹中的index.php将admin-panel作为我的应用程序文件夹.
我插入了这行$ route ['default_controller'] ="welcome"; $ route ['welcome'] ='welcome'; 在users.php中,在user-panel和admin-panel中
我可以通过使用访问我的用户面板和管理面板的欢迎控制器 http://localhost/myproject and http://localhost/myproject/admin
但我无法通过使用访问我的仪表板控制器 http://localhost/myproject/dashboard or http://localhost/myproject/admin/dashboard
我的仪表板控制器可以使用 http://localhost/myproject/index.php/dashboard or http://localhost/myproject/admin/index.php/dashboard
但我不希望index.php包含在我的网址中.我想删除它.我也试过在我的管理文件夹中使用.htaccess.我在这里写下面的一行
RewriteEngine On
RewriteCond $1 !^(index\.php|(.*)\.swf|robots\.txt)
RewriteRule ^(.*)$ index.php/$1 [L]
Run Code Online (Sandbox Code Playgroud)
但这对我不起作用.它给出了404未找到的CI错误.我还通过在httpd.conf中将AllowOerride None更改为AllowOverride All来启用mod_rewrite.请告诉我如何删除index.php以及我应该将.htaccess文件放在项目目录中的哪个位置.
当您没有代理IP列表时会发生什么?使用Akamai,Google,Edgecast或CloudFront等网站加速服务时; 从他们那里获取会话的IP总是很难.
在CDN上测试我们的codeigniter应用程序时,我们注意到IP作为CDN IP而不是会话数据库中的客户端IP传递.
你怎么能绕过这个?
/*
|--------------------------------------------------------------------------
| Reverse Proxy IPs
|--------------------------------------------------------------------------
|
| If your server is behind a reverse proxy, you must whitelist the proxy IP
| addresses from which CodeIgniter should trust the HTTP_X_FORWARDED_FOR
| header in order to properly identify the visitor's IP address.
| Comma-delimited, e.g. '10.0.1.200,10.0.1.201'
|
*/
$config['proxy_ips'] = '';
Run Code Online (Sandbox Code Playgroud)
谢谢!
我的Codeigniter 2.1.0应用程序中有这个错误控制器:
<?php
class Error extends CI_Controller
{
public function __construct()
{
parent::__construct();
}
public function index()
{
set_status_header(404);
$data->menuItems = Main::_menu();
$data->title = "404 error !";
$data->pageview = 'templates/404';
$this->load->view('templates/main', $data);
}
public function facebook()
{
set_status_header(404);
$data->menuItems = Main::_menu();
$data->title = "Facebook error !";
$data->pageview = "templates/facebook_error";
$this->load->view('templates/main', $data);
}
}
?>
Run Code Online (Sandbox Code Playgroud)
主控制器_menu:
<?php
class Main extends CI_Controller
{
// ... a lot of methods here ...
public static function _menu()
{
static $menuItems = array( //just a …Run Code Online (Sandbox Code Playgroud) 在使用转换后的查询中转义整数是否有任何意义intval()?
我正在使用这样的整数:
$sql .= " LIMIT " . $this->db->escape(intval($offset)) . ", 10";
Run Code Online (Sandbox Code Playgroud) 我正在使用嵌入式,它工作正常,但问题是对于某些视频它给出了错误 - not a valid key.我知道我们必须在他们的网站上注册并支付一些钱用于密钥但是,我不想这样做.是否有任何其他解决方案为视频嵌入代码,以便我可以把我的代码放在嵌入以外的其他代码上.如果是,请帮助我,或者如果可能请提供一些示例来执行此操作.密钥的代码如下所示.
$pro = new Embedly_API(array(
'key' => 'xxxxxxxxxxxxxxxx', //need a pro key for this
'user_agent' => 'Mozilla/5.0 (compatible; mytestapp/1.0)'
));
Run Code Online (Sandbox Code Playgroud)
提前致谢.
是否可以对单独的模型进行一次"交易".我想插入带有标签的帖子.标签和帖子分为两个独立的模型.我如何通过交易来处理它?(如下:)
$this->db->trans_start();
$this->post_model->insert('...');
$this->tags_model->insert('...');
$this->db->trans_complete();
Run Code Online (Sandbox Code Playgroud) 我无法使用Date数据类型将我的JQuery Datepicker中的值插入到我的MySQL数据库中.我将如何将字符串转换为日期数据类型?即时通讯使用Codeigniter与MVC.这是我的代码:
JavaScript的
<script>
$(function() {
$( "#datepicker" ).datepicker({
showOn: "button",
buttonImage: "images/icons/calendar_24.png",
buttonImageOnly: true,
onSelect: function(dateText, inst){
$("input[name='dob']").val(dateText);
}
});
});
</script>
Run Code Online (Sandbox Code Playgroud)
调节器
function create()
{
$data = array(
'FirstName' => $this->input->post('fname'),
'DateofBirth' => $this->input->post('dob')
);
$this->site_model->add_record($data);
$this->index();
}
Run Code Online (Sandbox Code Playgroud)
视图
<?php echo form_open('site/create');?>
<p>
<label for="fname">First Name:</label>
<input type="text" name="fname" />
</p>
<p>
<input type="text" name='dob' id="datepicker" />
</p>
Run Code Online (Sandbox Code Playgroud)
多谢你们!我在谷歌读了一些解决方案,我这样做了:
控制器:
function create()
{
$date = $this->input->post('dob');
$data = array(
'FirstName' => $this->input->post('fname'),
'DateofBirth' => date('Y-m-d', strtotime($date))
);
$this->site_model->add_record($data); …Run Code Online (Sandbox Code Playgroud) codeigniter ×10
php ×7
mysql ×2
api ×1
controller ×1
database ×1
http ×1
javascript ×1
jquery ×1
model ×1
passwords ×1
proxy ×1
session ×1
transactions ×1
validation ×1
video ×1