标签 原创 下的文章

PHP - 调用 webservice 接口 - php 5.4 以上

requestWsdl.php

<?php
header('content-type:text/html;charset=utf-8');
$ip = $_RESQUEST['ip'];
$function = $_REQUEST['function'];
$param = $_REQUEST['param'];
$res = new WSDL();
$res->getData($ip, $function, $param);
class WSDL{
    public function __construct(){
    }
    public function getData($ip, $function, $param = array()){
        try {
            $client = new SoapClient('http://' . $ip . '/xxx/Webservice?wsdl',
array('encoding' => 'UTF-8'));
            $result = $client->{$function}($param);
            $result = get_object_vars($result);
            print_r($result);
        } catch (SoapFault $exception) {
            print_r($exception);
        }
    }
    public function getFunctions($ip){
        $client = new SoapClient('http://' . $ip . '/xxx/Webservice?wsdl', 
array('encoding' => 'UTF-8'));
        $functions = $client->__getFunctions();
        print_r($functions);
    }
    public function getTypes($ip){
        $client = new SoapClient('http://' . $ip . '/xxx/Webservice?wsdl', array('encoding' => 'UTF-8'));
        $types = $client->__getTypes();
        print_r($types);
    }
}

阅读全文

Editor - 百度编辑器

实例化编辑器

var ue = UE.getEditor('editor2', {
    toolbars: [[
        'source', '|', 'undo', 'redo', '|',
        'bold', 'italic', 'underline', '|',
        'selectall', 'cleardoc', '|',
        'fontfamily', 'fontsize', '|',
        'justifyleft', 'justifycenter', 'justifyright', 'justifyjustify', '|',
        'simpleupload', '|',
        'removeformat', '|'
    ]],
    iframeCssUrl: '../ueditor/themes/editor2.css',
    initialFrameHeight:500,
    enableAutoSave: false,
    enableContextMenu: false,
    elementPathEnabled : false,
    focus:false,
    autoHeightEnabled:false
});

阅读全文

JS - 同一界面内实例化2个编辑器

js

//实例化编辑器editor
var ue = UE.getEditor('editor');
//实例化编辑器editor2
var ue2 = UE.getEditor('editor2');
function removeformat() {
    //全选
    ue.execCommand('selectall');
    //未格式化的内容
    var content1 = ue.getContent();
    //清除格式
    ue.execCommand('removeformat');
    //格式化后的内容
    var content2 = ue.getContent();
    //过滤掉&nbsp;
    content2 = content2.replace(/&nbsp;/g, "");
    //过滤掉<p><br/></p>
    content2 = content2.replace(/<p><br\/><\/p>/g, "");
    //保留原来的内容
    ue.setContent(content1, false);
    //将内容赋予编辑器2
    ue2.setContent(content2, false);
}

阅读全文

jQuery - ajax

jQuery

$.ajax({
            url: '/数据处理页面',
            type: 'POST',
            dataType: 'json',
            data: login,
            success: function (data) {
                if (data.code == 200) {
                    window.location.href = "/验证成功后的跳转页";
                } else {
                    errorDis(data.info);//返回错误提示
                    //alert(data.info);
                    return false;
                }
            }
        })

阅读全文