PHP調用OCX控制項的具體方法

來源:互聯網
上載者:User

標籤:ace   ati   text   save   style   知識庫   包含   例子   release   

需要設定php.ini檔案,找到這行com.allow_dcom=true,把com組件支援啟用

使用PHP調用OCX控制項,本不是個難題,但現實中採用flash迴避的方法更通用。真正使用ocx的不多,而且資料也比較少,從網上看到了一個成功的例子:

其實調用 OCX或者什麼什麼的控制項檔案包含進來

 

include("D:\wwwroot\Authen\Authen.ocx");

然後用COM函數調用它 其中參數是以 檔案名稱.類名的形式調用的 這點由為重要

$word = new COM("Authen.CAuthenCtrl") or die("Unable to instanciate Word");

就這麼簡單 就可以完成PHP調用控制項的工作了 ~~~呵呵  ~~~


偶是用MFC做的ActiveX控制項,
產生了一個Authen.PHP裡面引用首先
include("Authen.ocx的實體路徑");
$myCom = new COM("Authen.CAuthenCtrl") or die("Unable to instanciate Word");
Authen是檔案名稱
CAuthenCtrl是類名

來源:http://blog.chinaunix.NET/uid-22414998-id-113455.html


從手冊找到的
// 啟動 word
$word = new COM("word.application") or die("Unable to instanciate Word");
print "Loaded Word, version {$word->Version}\n";

//將其置前
$word->Visible = 1;

//開啟一個空文檔
$word->Documents->Add();

//隨便做些事情
$word->Selection->TypeText("This is a test...");
$word->Documents[1]->SaveAs("Useless test.doc");

//關閉 word
$word->Quit();

//釋放對象
$word->Release();
$word = null;

PHP調用OCX控制項的具體方法

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.