我正在尝试为我的网站完成一个相当简单的任务,但我不确定如何去做.我希望用户查看一个表,然后单击一个按钮,此时用户可以保存该表的内容为csv文件.此请求有时可能非常复杂,因此我生成一个进度页面以提醒用户.
除了实际生成csv文件之外,我发现了大多数事情.(我使用jQuery和PHP)
点击运行jQuery代码:
hmis_query_csv_export: function(query_name) {
$.uiLock('<p>Query Loading.</p><img src="/images/loading.gif" />')
$.get({
url: '/php_scripts/utils/csv_export.php',
data: {query_name: query_name},
success: function(data) {
$.uiUnlock();
}
});}
Run Code Online (Sandbox Code Playgroud)
相关的PHP:
header("Content-type: text/x-csv");
header("Content-Disposition: attachment; filename=search_results.csv");
//
//Generate csv
//
echo $csvOutput
exit();Run Code Online (Sandbox Code Playgroud)
这样做是将文本作为PHP文件发送,但它不会生成下载.我究竟做错了什么?
我正在尝试在postgres中创建一个表空间,但我遇到了所有权问题.我正在使用的命令是:
CREATE TABLESPACE magdat OWNER maggie LOCATION '/home/john/BSTablespace'
Run Code Online (Sandbox Code Playgroud)
我收到错误:
ERROR: could not set permissions on directory "/home/john/BSTablespace": Operation not permitted
Run Code Online (Sandbox Code Playgroud)
该文件夹属于postgres:postgres,我已经尝试将其更改为maggie,但如果我去了:
chown maggie:postgres /home/john/BSTablespace
Run Code Online (Sandbox Code Playgroud)
我明白了:
chown: invalid user: `maggie:postgres'
Run Code Online (Sandbox Code Playgroud)
为什么用户不存在?如果我列出postgres中的用户,它确实会出现.我有什么想法可能做错了吗?
我正在尝试在我的服务器上每30分钟运行一个PHP脚本(Win XP SP3,xampp 1.7.3).为此,我使用MS任务计划程序运行以下脚本(update.cmd)
SET PATH="C:\xampp\PHP"
start php.exe \htdocs\update_dashboard.phpRun Code Online (Sandbox Code Playgroud)
我在我的网络服务器上使用oci8 php扩展,但是当我运行该脚本时,它给了我错误,php.exe无法找到oci8扩展所需的dll.我收到以下错误:
This application has failed to start because OCI.dll was not found. Re-installing the application may fix this problem.
PHP Startup: Unable to load dynamic library 'C:\xampp\php\ext\php_oci8.dll' - The specified module count not be found.
C:\instantclient_11_2;C:\oracle\ora92\bin;C:\Program Files\Oracle\jre\1.3.1\bin;C:\Program Files\Oracle\jre\1.1.8\bin;C:\Program Files\ActiveState Komodo Edit 5\;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\Program Files\Altiris\Software Virtualization Agent\
This application has failed to start because OCI.dll was not found. Re-installing the application may fix this problem.
PHP Startup: Unable to load dynamic library …
我在设置和运行特定数据库时遇到问题.我正在尝试恢复我从其他人那里获得的postgreSQL转储.我试过几种方法都无济于事.
直接来自pg_restore
pg_restore -C -d postgres --exit-on-error maggie_prod_20111221.dump.sql
首先创建数据库和表空间
createdb -T template0 maggieprod -E LATIN1
SQL: CREATE TABLESPACE magdat OWNER maggie LOCATION '/somewhere/magdat';
pg_restore -v -d template1 maggie_prod_20110121.dump.sql
使用第一种方法,我得到以下内容:
pg_restore: [archiver (db)] Error while PROCESSING TOC:
pg_restore: [archiver (db)] Error from TOC entry 2308; 1262 16386 DATABASE maggieprod postgres
pg_restore: [archiver (db)] could not execute query: ERROR: encoding LATIN1 does not match locale en_CA.utf8
DETAIL: The chosen LC_CTYPE setting requires encoding UTF8.
Command was: CREATE DATABASE maggieprod WITH TEMPLATE = …
php ×2
postgresql ×2
ajax ×1
batch-file ×1
chown ×1
csv ×1
database ×1
latin1 ×1
locale ×1
tablespace ×1
xampp ×1