导航:首页 > 编程语言 > php播放ppt

php播放ppt

发布时间:2023-12-02 16:10:28

php怎么读取ppt文字内容并在浏览器中显示出来

具体代码麻烦我就不写了,可以提供给你一个思路:

首先要求服务器上安装wps或者microsoft powerpoint软件,然后通过api接口来访问并读取ppt,最后将其发送到页面。

当然你不能每次等别人访问的时候再去读取,不然太慢。。这个办法比较简便,如果你想直接读取,则需要详细了解ppt文件的格式。

⑵ 为什么ipad上下载的ppt打开变成PHP

如果不是下载本身资源的错误,把后缀php修改成PPT
如果你下载时没下载对,那么需要重下;如果仅仅是文件的扩展名错了,那么你可以将php改为ppt,需要设置文件宏激夹选项显示文件的扩展名才可以。
pdf全称是Portable Document File,PPT全称是PowerPoint,PPT 是与文档(Word),表格(Excel)并列的一蔽虚袜种演示文稿,PDF 则是PDF文件。PPT文件的后缀名誉激为:.ppt或.pptx;而PDF文件的后缀名为.pdf。

⑶ 怎么用php读取ppt文档的内容,并且在浏览器

本文实例讲述了PHP读取PPT文件的方法。分享给大家供大家参考,具体如下:
最近做一个和FLASH有关的东西,其中就要用到在网站上看PPT就像网络,豆丁网那样可以直接在网站上读,在网上搜了半天没搜到,都是些什么安装个软件什么的,PHP网站放到空间上,谁能让你在哪装软件呢?不是在瞎扯么?不过还好,最后在国外一个网站上搜到了一个解决思路,就是一个PHP操作PPT的类,当然这个网站还提供了操作OFFICES软件的其他类,不过是2007版的OFFICES
下面也贴出当时看到的一个例子:
本例子使用phppowerpoint类,使用该类注意两点,一个是了解参数含义,二注意字符集
?


<?phpheader("content-type:text/html;charset=utf-8");//字体设置防止乱码error_reporting(E_ALL);/** Include path **/set_include_path(get_include_path() . PATH_SEPARATOR . '../Classes/');/** PHPPowerPoint */include 'PHPPowerPoint.php';/** PHPPowerPoint_IOFactory */include 'PHPPowerPoint/IOFactory.php';// Create new PHPPowerPoint object//echo date('H:i:s') . " Create new PHPPowerPoint object\n";$objPHPPowerPoint = new PHPPowerPoint();$objPHPPowerPoint->getProperties()->setCreator("Maarten Balliauw");$objPHPPowerPoint->getProperties()->setLastModifiedBy("Maarten Balliauw");$objPHPPowerPoint->getProperties()->setTitle("Office 2007 PPTX Test Document");$objPHPPowerPoint->getProperties()->setSubject("Office 2007 PPTX Test Document");$objPHPPowerPoint->getProperties()->setDescription("Test document for Office 2007 PPTX, generated using PHP classes.");$objPHPPowerPoint->getProperties()->setKeywords("office 2007 openxml php");$objPHPPowerPoint->getProperties()->setCategory("Test result file");// Remove first slide//echo date('H:i:s') . " Remove first slide\n";$objPHPPowerPoint->removeSlideByIndex(0);// Create templated slide//echo date('H:i:s') . " Create templated slide\n";/*$currentSlide = createTemplatedSlide($objPHPPowerPoint); // local function// Create a shape (text)echo date('H:i:s') . " Create a shape (rich text)\n";$shape = $currentSlide->createRichTextShape();$shape->setHeight(200);$shape->setWidth(600);$shape->setOffsetX(10);$shape->setOffsetY(400);$shape->getAlignment()->setHorizontal( PHPPowerPoint_Style_Alignment::HORIZONTAL_LEFT );$textRun = $shape->createTextRun('Introction to');$textRun->getFont()->setBold(true);$textRun->getFont()->setSize(28);$textRun->getFont()->setColor( new PHPPowerPoint_Style_Color( 'FFFFFFFF' ) );$shape->createBreak();$textRun = $shape->createTextRun('PHPPowerPoint');$textRun->getFont()->setBold(true);$textRun->getFont()->setSize(60);$textRun->getFont()->setColor( new PHPPowerPoint_Style_Color( 'FFFFFFFF' ) );// Create templated slideecho date('H:i:s') . " Create templated slide\n";$currentSlide = createTemplatedSlide($objPHPPowerPoint); // local function// Create a shape (text)echo date('H:i:s') . " Create a shape (rich text)\n";$shape = $currentSlide->createRichTextShape();$shape->setHeight(100);$shape->setWidth(930);$shape->setOffsetX(10);$shape->setOffsetY(10);$shape->getAlignment()->setHorizontal( PHPPowerPoint_Style_Alignment::HORIZONTAL_LEFT );$textRun = $shape->createTextRun('What is PHPPowerPoint?');$textRun->getFont()->setBold(true);$textRun->getFont()->setSize(48);$textRun->getFont()->setColor( new PHPPowerPoint_Style_Color( 'FFFFFFFF' ) );// Create a shape (text)echo date('H:i:s') . " Create a shape (rich text)\n";$shape = $currentSlide->createRichTextShape();$shape->setHeight(600);$shape->setWidth(930);$shape->setOffsetX(10);$shape->setOffsetY(100);$shape->getAlignment()->setHorizontal( PHPPowerPoint_Style_Alignment::HORIZONTAL_LEFT );$textRun = $shape->createTextRun('- A class library');$textRun->getFont()->setSize(36);$textRun->getFont()->setColor( new PHPPowerPoint_Style_Color( 'FFFFFFFF' ) );$shape->createBreak();$textRun = $shape->createTextRun('- Written in PHP');$textRun->getFont()->setSize(36);$textRun->getFont()->setColor( new PHPPowerPoint_Style_Color( 'FFFFFFFF' ) );$shape->createBreak();$textRun = $shape->createTextRun('- Representing a presentation');$textRun->getFont()->setSize(36);$textRun->getFont()->setColor( new PHPPowerPoint_Style_Color( 'FFFFFFFF' ) );$shape->createBreak();$textRun = $shape->createTextRun('- Supports writing to different file formats');$textRun->getFont()->setSize(36);$textRun->getFont()->setColor( new PHPPowerPoint_Style_Color( 'FFFFFFFF' ) );// Create templated slideecho date('H:i:s') . " Create templated slide\n";$currentSlide = createTemplatedSlide($objPHPPowerPoint); // local function// Create a shape (text)echo date('H:i:s') . " Create a shape (rich text)\n";$shape = $currentSlide->createRichTextShape();$shape->setHeight(100);$shape->setWidth(930);$shape->setOffsetX(10);$shape->setOffsetY(10);$shape->getAlignment()->setHorizontal( PHPPowerPoint_Style_Alignment::HORIZONTAL_LEFT );$textRun = $shape->createTextRun('What\'s the point?');$textRun->getFont()->setBold(true);$textRun->getFont()->setSize(48);$textRun->getFont()->setColor( new PHPPowerPoint_Style_Color( 'FFFFFFFF' ) );// Create a shape (text)echo date('H:i:s') . " Create a shape (rich text)\n";$shape = $currentSlide->createRichTextShape();$shape->setHeight(600);$shape->setWidth(930);$shape->setOffsetX(10);$shape->setOffsetY(100);$shape->getAlignment()->setHorizontal( PHPPowerPoint_Style_Alignment::HORIZONTAL_LEFT );$textRun = $shape->createTextRun('- Generate slide decks');$textRun->getFont()->setSize(36);$textRun->getFont()->setColor( new PHPPowerPoint_Style_Color( 'FFFFFFFF' ) );$shape->createBreak();$textRun = $shape->createTextRun(' - Represent business data');$textRun->getFont()->setSize(28);$textRun->getFont()->setColor( new PHPPowerPoint_Style_Color( 'FFFFFFFF' ) );$shape->createBreak();$textRun = $shape->createTextRun(' - Show a family slide show');$textRun->getFont()->setSize(28);$textRun->getFont()->setColor( new PHPPowerPoint_Style_Color( 'FFFFFFFF' ) );$shape->createBreak();$textRun = $shape->createTextRun(' - ...');$textRun->getFont()->setSize(28);$textRun->getFont()->setColor( new PHPPowerPoint_Style_Color( 'FFFFFFFF' ) );$shape->createBreak();$textRun = $shape->createTextRun('- Export these to different formats');$textRun->getFont()->setSize(36);$textRun->getFont()->setColor( new PHPPowerPoint_Style_Color( 'FFFFFFFF' ) );$shape->createBreak();$textRun = $shape->createTextRun(' - PowerPoint 2007');$textRun->getFont()->setSize(28);$textRun->getFont()->setColor( new PHPPowerPoint_Style_Color( 'FFFFFFFF' ) );$shape->createBreak();$textRun = $shape->createTextRun(' - Serialized');$textRun->getFont()->setSize(28);$textRun->getFont()->setColor( new PHPPowerPoint_Style_Color( 'FFFFFFFF' ) );$shape->createBreak();$textRun = $shape->createTextRun(' - ... (more to come) ...');$textRun->getFont()->setSize(28);$textRun->getFont()->setColor( new PHPPowerPoint_Style_Color( 'FFFFFFFF' ) );// Create templated slideecho date('H:i:s') . " Create templated slide\n";$currentSlide = createTemplatedSlide($objPHPPowerPoint); // local function// Create a shape (text)echo date('H:i:s') . " Create a shape (rich text)\n";$shape = $currentSlide->createRichTextShape();$shape->setHeight(100);$shape->setWidth(930);$shape->setOffsetX(10);$shape->setOffsetY(10);$shape->getAlignment()->setHorizontal( PHPPowerPoint_Style_Alignment::HORIZONTAL_LEFT );$textRun = $shape->createTextRun('Need more info?');$textRun->getFont()->setBold(true);$textRun->getFont()->setSize(48);$textRun->getFont()->setColor( new PHPPowerPoint_Style_Color( 'FFFFFFFF' ) );// Create a shape (text)echo date('H:i:s') . " Create a shape (rich text)\n";$shape = $currentSlide->createRichTextShape();$shape->setHeight(600);$shape->setWidth(930);$shape->setOffsetX(10);$shape->setOffsetY(100);$shape->getAlignment()->setHorizontal( PHPPowerPoint_Style_Alignment::HORIZONTAL_LEFT );$textRun = $shape->createTextRun('Check the project site on CodePlex:');$textRun->getFont()->setSize(36);$textRun->getFont()->setColor( new PHPPowerPoint_Style_Color( 'FFFFFFFF' ) );$shape->createBreak();$textRun = $shape->createTextRun(' );$textRun->getFont()->setSize(36);$textRun->getFont()->setColor( new PHPPowerPoint_Style_Color( 'FFFFFFFF' ) );// Create templated slideecho date('H:i:s') . " Create templated slide\n";*///test//从数据库调取数据进行for循环$row=array('titlepic'=>array('./images/love.gif','./images/love1.gif','./images/love2.gif','./images/love3.gif'),'xsprice'=>array("55","33","22","333"),'cjid'=>array('100','222','333','3333'),'lpid'=>array('111','222','333','444'),'price'=>array('111','433','243','3245'));for($i=0;$i<4;$i++){$currentSlide = createTemplatedSlide1($objPHPPowerPoint,$row["titlepic"][$i]); // local function// Create a shape (text)//echo date('H:i:s') . " Create a shape (rich text)\n";$shape = $currentSlide->createRichTextShape();$shape->setHeight(100);$shape->setWidth(930);//调整字体的高度宽度$shape->setOffsetX(20);$shape->setOffsetY(400);//$shape->getAlignment()->setHorizontal( PHPPowerPoint_Style_Alignment::HORIZONTAL_LEFT );$row["price"]=iconv("utf-8","gb2312",$row["price"][$i]);$textRun = $shape->createTextRun('礼品网价格:'.$row["xsprice"][$i]);$textRun->getFont()->setBold(true);$textRun->getFont()->setSize(48);$textRun->getFont()->setColor( new PHPPowerPoint_Style_Color( '#000000' ) );$shape = $currentSlide->createRichTextShape();$shape->setHeight(600);$shape->setWidth(930);$shape->setOffsetX(20);$shape->setOffsetY(500);$shape->getAlignment()->setHorizontal( PHPPowerPoint_Style_Alignment::HORIZONTAL_LEFT );//添加多行内容从这开始$textRun = $shape->createTextRun('公司编号: '.$row["cjid"][$i]);$textRun->getFont()->setSize(36);$textRun->getFont()->setColor( new PHPPowerPoint_Style_Color( '#000000' ) );$shape->createBreak();$textRun = $shape->createTextRun('礼品网编号: '.$row["lpid"][$i]);$textRun->getFont()->setSize(36);$textRun->getFont()->setColor( new PHPPowerPoint_Style_Color( '#000000' ) );//test// Save PowerPoint 2007 file}//echo date('H:i:s') . " Write to PowerPoint2007 format\n";$objWriter = PHPPowerPoint_IOFactory::createWriter($objPHPPowerPoint, 'PowerPoint2007');$objWriter->save(str_replace('.php', '.pptx',__FILE__));header("Content-type:application/vnd.ms-powerpoint;");header("location:02presentation.pptx");// Echo memory peak usage//echo date('H:i:s') . " Peak memory usage: " . (memory_get_peak_usage(true) / 1024 / 1024) . " MB\r\n";// Echo done//echo date('H:i:s') . " Done writing file.\r\n";/*** Creates a templated slide** @param PHPPowerPoint $objPHPPowerPoint* @return PHPPowerPoint_Slide*/function createTemplatedSlide1(PHPPowerPoint $objPHPPowerPoint,$cs1){// Create slide$slide = $objPHPPowerPoint->createSlide();// Add background image$shape = $slide->createDrawingShape();$shape->setName('Background');$shape->setDescription('Background');$shape->setPath('./images/realdolmen_bg.jpg');$shape->setWidth(950);$shape->setHeight(720);$shape->setOffsetX(0);$shape->setOffsetY(0);// Add logo$shape = $slide->createDrawingShape();$shape->setName('PHPPowerPoint logo');$shape->setDescription('PHPPowerPoint logo');$shape->setPath($cs1);$shape->setHeight(120);$shape->setOffsetX(10);$shape->setOffsetY(10);// Return slidereturn $slide;}

阅读全文

与php播放ppt相关的资料

热点内容
javatif转jpg 浏览:165
java设置按钮的位置 浏览:686
互联网商业模式pdf 浏览:440
cmdcopycon命令 浏览:933
pdf火车 浏览:77
幻世九歌怎么选服务器 浏览:163
ubuntu反编译工具使用方法 浏览:910
stc20脚单片机 浏览:352
pdf吉他独奏 浏览:484
phpsort排序 浏览:917
三种条件编译指令 浏览:945
怎么知道app扣的啥费用 浏览:320
没有服务器地址测试微信接口 浏览:392
51单片机报警器 浏览:431
python任意范围猜数字游戏 浏览:567
程序员打电话搞笑视频 浏览:129
完美校园app怎么销假 浏览:902
多开宏命令 浏览:884
战地1如何匹配官方服务器 浏览:382
武汉金税系统服务器地址 浏览:844