小编Sal*_*ani的帖子

是否值得在OOP中获取和设置方法?

我已经看到一些项目,其中类有get和set方法来操作插入数据.让我举个例子:

    class Student extends dbClass
{
    private $TableID;
    private $FullName;
    private $Gender;
    private $Address;




    function setTableID($Value)
    {
        $this->TableID = $Value;
    }

    function getTableID()
    {
        return $this->TableID;
    }

    function setFullName($Value)
    {
        $this->FullName = $Value;
    }

    function getFullName()
    {
        return $this->FullName;
    }

    function setGender($Value)
    {
        $this->Gender = $Value;
    }

    function getGender()
    {
        return $this->Gender;
    }

    function setAddress($Value)
    {
        $this->Address = $Value;
    }

    function getAddress()
    {
        return $this->Address;
    }


    function UpdateStudent()
    {
        $sql = "UPDATE INTO usertable SET
        FullName = '".$this->getFullName()."',
        Gender = …
Run Code Online (Sandbox Code Playgroud)

php oop get set

14
推荐指数
2
解决办法
1万
查看次数

以编程方式添加带附件的Wordpress帖子

我在$ _REQUEST中获取post_title,post_content和其他内容以及图像文件.我想将所有内容保存为wordpress数据库中的帖子.我在我的页面上

<?php
require_once("wp-config.php");
$user_ID; //getting it from my function
$post_title = $_REQUEST['post_title'];
$post_content = $_REQUEST['post_content'];
$post_cat_id = $_REQUEST['post_cat_id']; //category ID of the post
$filename = $_FILES['image']['name'];

//I got this all in a array

$postarr = array(
 'post_status' => 'publish',
 'post_type' => 'post',
 'post_title' => $post_title,
 'post_content' => $post_content,
 'post_author' => $user_ID,
 'post_category' => array($category) 
 );
$post_id = wp_insert_post($postarr);

?>
Run Code Online (Sandbox Code Playgroud)

这将获取数据库中的所有内容作为post但我不知道如何添加附件及其post meta.

我怎样才能做到这一点?有谁能够帮我?我真的很困惑,并花了几天时间试图解决这个问题.

php wordpress

8
推荐指数
1
解决办法
2万
查看次数

Aramex API集成

有谁知道Aramex Shipping服务及其API?我在他们的网站上找到了示例代码并应用了我的API凭据,但是我收到了一个错误.任何人都可以帮我整合这个吗?

https://rsidemos.com/development1/minishop/aramex/tracking.php

shipping aramex

7
推荐指数
0
解决办法
3078
查看次数

标签 统计

php ×2

aramex ×1

get ×1

oop ×1

set ×1

shipping ×1

wordpress ×1