<?php $ip = $_SERVER['SERVER_NAME']; //获取本机IP require_once "http://" . $ip . ":8080/JavaBridge/java/Java.inc"; //此行必须 $fs = new Java("com.zhuozhengsoft.pageoffice.FileSaverPHP"); //此行必须 $fs->load(file_get_contents("php://input")); //此行必须 java_set_file_encoding("GBK"); //设置编码格式 //获取通过Url传递过来的值 $id = 0; $id = $_REQUEST["id"]; $filepath = dirname($_SERVER["SCRIPT_FILENAME"]); $fs->saveToFile($filepath . "/page/" . $id . "/" . $fs->getFileName()); //保存文件 echo $fs->close(); //此行必须 ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>My JSP 'SaveFile.jsp' starting page</title> <meta http-equiv="pragma" content="no-cache"> <meta http-equiv="cache-control" content="no-cache"> <meta http-equiv="expires" content="0">
require_once "http://" . $ip . ":8080/JavaBridge/java/Java.inc"; //此行必须 $fs = new Java("com.zhuozhengsoft.pageoffice.FileSaverPHP"); //此行必须 $fs->load(file_get_contents("php://input")); //此行必须 $id = $_REQUEST["id"]; $filepath = dirname($_SERVER["SCRIPT_FILENAME"]) . "/doc/" . $id . "/" . date('Ymd', time()); //$filepath=dirname($_SERVER["SCRIPT_FILENAME"])."/doc"; $type = $_REQUEST['type']; java_set_file_encoding("GBK"); //设置编码格式 $fileName = $type . $fs->getFileExtName(); //$fileName = "make.html"; //$filepath=dirname($_SERVER["SCRIPT_FILENAME"]); $fs->saveToFile($filepath . "/" . $fileName); //保存文件 echo $fs->close(); //此行必须 ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>My JSP 'SaveMaker.jsp' starting page</title> <meta http-equiv="pragma" content="no-cache"> <meta http-equiv="cache-control" content="no-cache"> <meta http-equiv="expires" content="0">
function saveOnlineEditWord() { // $ip = GetHostByName($_SERVER['SERVER_NAME']);//获取本机IP $ip = C("DB_HOST_WORD"); //"192.168.0.238"; require_once "http://{$ip}:8088/JavaBridge/java/Java.inc"; //此行必须 $fs = new Java("com.zhuozhengsoft.pageoffice.FileSaverPHP"); //此行必须 echo $fs->close(); //此行必须 $fs->load(file_get_contents("php://input")); //此行必须 java_set_file_encoding("utf8"); //设置编码格式 $socuse = str_replace("\\", "/", base64_decode($_REQUEST['name'])); $file_path = str_replace("\\", "/", UPLOAD_PATH . $socuse); $fs->saveToFile($file_path); //保存文件 echo $fs->close(); //此行必须 }
<?php $ip = GetHostByName($_SERVER['SERVER_NAME']); //获取本机IP require_once "http://" . $ip . ":8080/JavaBridge/java/Java.inc"; //此行必须 $fs = new Java("com.zhuozhengsoft.pageoffice.FileSaverPHP"); //此行必须 $fs->load(file_get_contents("php://input")); //此行必须 java_set_file_encoding("GBK"); //设置编码格式 $filepath = dirname($_SERVER["SCRIPT_FILENAME"]); $fs->saveToFile($filepath . "/doc/9/20151028/question" . $fs->getFileExtName()); //$fs->saveToFile($filepath."/doc/qq2.doc"); //保存文件 //$fs->saveToFile($filepath."/doc/qq2.html".$fs->getFileExtName() ); //保存文件 // $fs->saveToFile($filepath."/doc/".$_SESSION['uid']."/".date('Ymd',time())."/answer.doc"); //保存文件 //$fs->saveToFile($filepath."/doc/".$_SESSION['uid']."/".date('Ymd',time())."/jiexi.doc"); //保存文件 echo $fs->close(); //此行必须 ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title></title> <meta http-equiv="pragma" content="no-cache"> <meta http-equiv="cache-control" content="no-cache">