Coder Social home page Coder Social logo

php-webview-expand's Introduction

php-webview-expand

需要安装PHPCPP

下载

配置 php.ini 文件

extension=webview.so
$webview = new WebView();
// 创建窗口 参数:debug = bool
$webview->create(debug:false);
// 初始化注入js,代码在window.onload之前执行
$webview->init(js:"alert('asd');");
// 设置窗口大小 参数:width = int ,height = int ,hint = int (0~3)
$webview->size(width:400,height:300,hint:0);
// 设置窗口标题     参数:title=string
$webview->title(title:"新的标题");
// 设置html内容     参数:html=string
$webview->html(html:"<a>html的内容</a>");
// 绑定交互的操作    参数:name=string ,闭包函数:$req 是接收到的参数,$seq 是触发次数
$webview->bind(name:"bindName",function($seq, $req){
    return ["返回内容","返回数组"];
});
// 解除绑定         参数:name=你绑定过的name名
$webview->unbind(name:"bindName");
// 设置窗口url内容  参数:url=string
$webview->navigate(url:"http://www.baidu.com");
// 运行
$webview->run();
// 销毁
$webview->destroy();

示例

<?php

$w->create(false)
->title("php")
->size(400,380,1)
->html("<p>html-php</p>")
->run()
->destroy();

效果

Linux桌面系统测试结果

ubnutu桌面版->成功

deepin桌面版->失败(只有空白窗口)

php-webview-expand's People

Contributors

kingbes avatar

Stargazers

 avatar

Watchers

 avatar

Forkers

xbmtbc

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.